/* === Theme Variables === */
:root {
  /* Light (default) */
  --color-bg:             #ffffff;
  --color-bg-muted:       #f6f8fa;
  --color-bg-highlight:   #ddf4ff;
  --color-text:           #1f2328;
  --color-text-muted:     #656d76;
  --color-link:           #0969da;
  --color-border:         #d1d9e0;
  --color-header-bg:      #24292f;
  --color-header-text:    #ffffff;
  --color-header-muted:   #8b949e;
  --color-badge-bg:       #ddf4ff;
  --color-badge-text:     #0969da;
  --color-badge-border:   #54aeff66;
  --color-code-bg:        #eff1f3;
  --color-icon-dir:       #54aeff;
  --color-icon-file:      #656d76;
  --color-blockquote:     #656d76;
  --color-blockquote-border: #d1d9e0;
  --color-iframe-bg:      #ffffff;
  --fund-positive:        #dc2626;
  --fund-negative:        #16a34a;
  --fund-card-bg:         #ffffff;
  --fund-card-border:     #d1d9e0;
}

[data-theme="paper"] {
  --color-bg:             #faf6f0;
  --color-bg-muted:       #f3ede4;
  --color-bg-highlight:   #ede4d4;
  --color-text:           #3d3529;
  --color-text-muted:     #8a7e6b;
  --color-link:           #8b5e3c;
  --color-border:         #e0d5c4;
  --color-header-bg:      #4a4035;
  --color-header-text:    #faf6f0;
  --color-header-muted:   #b5a998;
  --color-badge-bg:       #ede4d4;
  --color-badge-text:     #8b5e3c;
  --color-badge-border:   #c4a882aa;
  --color-code-bg:        #eee7db;
  --color-icon-dir:       #b8924a;
  --color-icon-file:      #8a7e6b;
  --color-blockquote:     #8a7e6b;
  --color-blockquote-border: #e0d5c4;
  --color-iframe-bg:      #faf6f0;
  --fund-positive:        #b91c1c;
  --fund-negative:        #15803d;
  --fund-card-bg:         #f3ede4;
  --fund-card-border:     #e0d5c4;
}

[data-theme="dark"] {
  --color-bg:             #0a0b0f;
  --color-bg-muted:       #1c1d28;
  --color-bg-highlight:   #252636;
  --color-text:           #e8e6e1;
  --color-text-muted:     #9a9890;
  --color-link:           #6ee7b7;
  --color-border:         rgba(255,255,255,0.06);
  --color-header-bg:      #0a0b0f;
  --color-header-text:    #e8e6e1;
  --color-header-muted:   #5c5b56;
  --color-badge-bg:       #252636;
  --color-badge-text:     #6ee7b7;
  --color-badge-border:   rgba(110,231,183,0.2);
  --color-code-bg:        #252636;
  --color-icon-dir:       #6ee7b7;
  --color-icon-file:      #9a9890;
  --color-blockquote:     #9a9890;
  --color-blockquote-border: rgba(255,255,255,0.06);
  --color-iframe-bg:      #14151e;
  --fund-positive:        #f87171;
  --fund-negative:        #6ee7b7;
  --fund-card-bg:         #14151e;
  --fund-card-border:     rgba(255,255,255,0.06);
}

[data-theme="fund"] {
  --color-bg:             #0a0b0f;
  --color-bg-muted:       #12131a;
  --color-bg-highlight:   #1a1b24;
  --color-text:           #e8e6e1;
  --color-text-muted:     #9a9890;
  --color-link:           #6ee7b7;
  --color-border:         rgba(255,255,255,0.06);
  --color-header-bg:      #0a0b0f;
  --color-header-text:    #e8e6e1;
  --color-header-muted:   #5c5b56;
  --color-badge-bg:       #1a1b24;
  --color-badge-text:     #6ee7b7;
  --color-badge-border:   rgba(110,231,183,0.2);
  --color-code-bg:        #1a1b24;
  --color-icon-dir:       #6ee7b7;
  --color-icon-file:      #9a9890;
  --color-blockquote:     #9a9890;
  --color-blockquote-border: rgba(255,255,255,0.06);
  --color-iframe-bg:      #0a0b0f;
  --fund-positive:        #f87171;
  --fund-negative:        #6ee7b7;
  --fund-card-bg:         #14151e;
  --fund-card-border:     rgba(255,255,255,0.06);
  color-scheme: dark;
}

/* ── Terminal Themes (5 variants) ── */
[data-theme="terminal-bloomberg"] {
  --t-bg: #141418; --t-bg-panel: #1A1A1E; --t-bg-deep: #0E0E12;
  --t-title: #FF8C00; --t-names: #4FC3F7; --t-text: #E0E0E0;
  --t-muted: #888888; --t-up: #E05050; --t-down: #2EAA6E;
  --t-border: rgba(255,140,0,0.15); --t-selection: rgba(255,140,0,0.10);
  --t-dot-on: #2EAA6E; --t-dot-off: #E05050; --t-link: #4FC3F7;
  --color-bg: #141418; --color-bg-muted: #1A1A1E; --color-bg-highlight: #222226;
  --color-text: #E0E0E0; --color-text-muted: #888888; --color-link: #4FC3F7;
  --color-border: rgba(255,140,0,0.15); --color-header-bg: #0E0E12;
  --color-header-text: #FF8C00; --color-header-muted: #888888;
  --fund-positive: #E05050; --fund-negative: #2EAA6E;
  --fund-card-bg: #1A1A1E; --fund-card-border: rgba(255,140,0,0.15);
  color-scheme: dark;
  /* V2 变量别名 */
  --bg-0: #0a0a0a; --bg-1: #111; --bg-2: #1a1a1a; --bg-3: #2a2a2a;
  --accent: #ff6600; --accent-dim: #cc5200; --accent-glow: rgba(255,102,0,.08);
  --gold: #ff9933; --gold-bg: rgba(255,153,51,.08);
  --up: #e23d3d; --up-bg: rgba(226,61,61,.10);
  --down: #2dbe60; --down-bg: rgba(45,190,96,.10);
  --t1: #e8e8e8; --t2: #999; --t3: #666; --t4: #3a3a3a;
  --border: #222; --border-s: #1a1a1a;
  --font-num: 'JetBrains Mono', monospace;
  --font-cn: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-trade: var(--font-cn);
  --nav-h: 44px; --row-h: 22px; --hdr-h: 26px;
}
[data-theme="terminal-jade"] {
  --t-bg: #0F1A18; --t-bg-panel: #142220; --t-bg-deep: #0A1412;
  --t-title: #50C878; --t-names: #7ECBA1; --t-text: #C8D6D0;
  --t-muted: #5F7A6E; --t-up: #D06060; --t-down: #3EB88A;
  --t-border: rgba(80,200,120,0.15); --t-selection: rgba(80,200,120,0.10);
  --t-dot-on: #3EB88A; --t-dot-off: #D06060; --t-link: #7ECBA1;
  --color-bg: #0F1A18; --color-bg-muted: #142220; --color-bg-highlight: #1A2E2A;
  --color-text: #C8D6D0; --color-text-muted: #5F7A6E; --color-link: #7ECBA1;
  --color-border: rgba(80,200,120,0.15); --color-header-bg: #0A1412;
  --color-header-text: #50C878; --color-header-muted: #5F7A6E;
  --fund-positive: #D06060; --fund-negative: #3EB88A;
  --fund-card-bg: #142220; --fund-card-border: rgba(80,200,120,0.15);
  color-scheme: dark;
  /* V2 变量别名 */
  --bg-0: #060e0a; --bg-1: #0a1a14; --bg-2: #0f2b20; --bg-3: #1a3d2e;
  --accent: #4ecca3; --accent-dim: #2d8b6f; --accent-glow: rgba(78,204,163,.10);
  --gold: #d4a84b; --gold-bg: rgba(212,168,75,.08);
  --up: #e23d3d; --up-bg: rgba(226,61,61,.10);
  --down: #2dbe60; --down-bg: rgba(45,190,96,.10);
  --t1: #e8e8e8; --t2: #999; --t3: #666; --t4: #3a3a3a;
  --border: #1a2e22; --border-s: #111a14;
  --font-num: 'JetBrains Mono', monospace;
  --font-cn: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-trade: var(--font-cn);
  --nav-h: 44px; --row-h: 22px; --hdr-h: 26px;
}
[data-theme="terminal-gold"] {
  --t-bg: #161210; --t-bg-panel: #1C1814; --t-bg-deep: #100E0C;
  --t-title: #C9A84C; --t-names: #DABE70; --t-text: #D8CCB8;
  --t-muted: #7A6E5A; --t-up: #C86050; --t-down: #5EAA70;
  --t-border: rgba(201,168,76,0.15); --t-selection: rgba(201,168,76,0.10);
  --t-dot-on: #5EAA70; --t-dot-off: #C86050; --t-link: #DABE70;
  --color-bg: #161210; --color-bg-muted: #1C1814; --color-bg-highlight: #242018;
  --color-text: #D8CCB8; --color-text-muted: #7A6E5A; --color-link: #DABE70;
  --color-border: rgba(201,168,76,0.15); --color-header-bg: #100E0C;
  --color-header-text: #C9A84C; --color-header-muted: #7A6E5A;
  --fund-positive: #C86050; --fund-negative: #5EAA70;
  --fund-card-bg: #1C1814; --fund-card-border: rgba(201,168,76,0.15);
  color-scheme: dark;
  /* V2 变量别名 */
  --bg-0: #08080f; --bg-1: #0e0e1a; --bg-2: #1a1a30; --bg-3: #2a2a4a;
  --accent: #d4a84b; --accent-dim: #a0802a; --accent-glow: rgba(212,168,75,.08);
  --gold: #f0d68a; --gold-bg: rgba(240,214,138,.08);
  --up: #e23d3d; --up-bg: rgba(226,61,61,.10);
  --down: #2dbe60; --down-bg: rgba(45,190,96,.10);
  --t1: #e8e8e8; --t2: #999; --t3: #666; --t4: #3a3a3a;
  --border: #1a1a2e; --border-s: #12121e;
  --font-num: 'JetBrains Mono', monospace;
  --font-cn: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-trade: var(--font-cn);
  --nav-h: 44px; --row-h: 22px; --hdr-h: 26px;
}
[data-theme="terminal-aurora"] {
  --t-bg: #0A1420; --t-bg-panel: #0E1A28; --t-bg-deep: #06101A;
  --t-title: #00BCD4; --t-names: #4DD0E1; --t-text: #C0D8E8;
  --t-muted: #5A7888; --t-up: #D46060; --t-down: #26A69A;
  --t-border: rgba(0,188,212,0.15); --t-selection: rgba(0,188,212,0.10);
  --t-dot-on: #26A69A; --t-dot-off: #D46060; --t-link: #4DD0E1;
  --color-bg: #0A1420; --color-bg-muted: #0E1A28; --color-bg-highlight: #142230;
  --color-text: #C0D8E8; --color-text-muted: #5A7888; --color-link: #4DD0E1;
  --color-border: rgba(0,188,212,0.15); --color-header-bg: #06101A;
  --color-header-text: #00BCD4; --color-header-muted: #5A7888;
  --fund-positive: #D46060; --fund-negative: #26A69A;
  --fund-card-bg: #0E1A28; --fund-card-border: rgba(0,188,212,0.15);
  color-scheme: dark;
  /* V2 变量别名 */
  --bg-0: #060a10; --bg-1: #0a1420; --bg-2: #102030; --bg-3: #183048;
  --accent: #5bbcd6; --accent-dim: #3a8ea8; --accent-glow: rgba(91,188,214,.08);
  --gold: #f0d68a; --gold-bg: rgba(240,214,138,.08);
  --up: #e23d3d; --up-bg: rgba(226,61,61,.10);
  --down: #2dbe60; --down-bg: rgba(45,190,96,.10);
  --t1: #e8e8e8; --t2: #999; --t3: #666; --t4: #3a3a3a;
  --border: #152535; --border-s: #0e1a28;
  --font-num: 'JetBrains Mono', monospace;
  --font-cn: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-trade: var(--font-cn);
  --nav-h: 44px; --row-h: 22px; --hdr-h: 26px;
}
[data-theme="terminal-graphite"] {
  --t-bg: #1E1E1E; --t-bg-panel: #252525; --t-bg-deep: #181818;
  --t-title: #E0E0E0; --t-names: #9E9E9E; --t-text: #CCCCCC;
  --t-muted: #616161; --t-up: #D47070; --t-down: #60B080;
  --t-border: rgba(224,224,224,0.12); --t-selection: rgba(224,224,224,0.08);
  --t-dot-on: #60B080; --t-dot-off: #D47070; --t-link: #9E9E9E;
  --color-bg: #1E1E1E; --color-bg-muted: #252525; --color-bg-highlight: #2E2E2E;
  --color-text: #CCCCCC; --color-text-muted: #616161; --color-link: #9E9E9E;
  --color-border: rgba(224,224,224,0.12); --color-header-bg: #181818;
  --color-header-text: #E0E0E0; --color-header-muted: #616161;
  --fund-positive: #D47070; --fund-negative: #60B080;
  --fund-card-bg: #252525; --fund-card-border: rgba(224,224,224,0.12);
  color-scheme: dark;
  /* V2 变量别名 */
  --bg-0: #0c0c0c; --bg-1: #141414; --bg-2: #1e1e1e; --bg-3: #2e2e2e;
  --accent: #8a8a8a; --accent-dim: #666; --accent-glow: rgba(138,138,138,.08);
  --gold: #c0c0c0; --gold-bg: rgba(192,192,192,.08);
  --up: #e23d3d; --up-bg: rgba(226,61,61,.10);
  --down: #2dbe60; --down-bg: rgba(45,190,96,.10);
  --t1: #e8e8e8; --t2: #999; --t3: #666; --t4: #3a3a3a;
  --border: #222; --border-s: #1a1a1a;
  --font-num: 'JetBrains Mono', monospace;
  --font-cn: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-trade: var(--font-cn);
  --nav-h: 44px; --row-h: 22px; --hdr-h: 26px;
}

/* === Reset & Base === */
html {
    scrollbar-gutter: stable;
    overscroll-behavior: none;
    overflow: auto;
    height: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overscroll-behavior: none;
    height: 100%;
}
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Header === */
.site-header {
    background: var(--color-header-bg);
    border-bottom: 1px solid var(--color-border);
    position: relative;
    z-index: 50;
}
.header-nav {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-logo {
    color: var(--color-header-text);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
}
.header-logo:hover { color: var(--color-header-muted); text-decoration: none; }
.header-nav-item.muted {
    color: var(--color-header-muted);
    font-size: 14px;
    cursor: default;
}

/* === Section Tabs === */
.section-tabs {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  touch-action: pan-y;
}
.section-tabs-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.section-tabs-inner::-webkit-scrollbar { display: none; }
.section-tab {
  padding: 8px 16px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  flex-shrink: 0;
}
.section-tab:hover {
  color: var(--color-text);
  text-decoration: none;
}
.section-tab.active {
  color: var(--color-text);
  font-weight: 600;
  border-bottom-color: var(--color-link);
}
.tab-icon {
  width: 16px;
  height: 16px;
  vertical-align: text-bottom;
  margin-right: 4px;
}

/* === Tab Dropdown (AI数据库) === */
.section-tab-dropdown {
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
}
.section-tab-label {
  display: flex;
  align-items: center;
  gap: 2px;
}
.dropdown-chevron {
  margin-left: 2px;
  transition: transform 0.2s;
}
.section-tab-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
}
.tab-dropdown-menu {
  display: none;
  position: fixed;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 140px;
  z-index: 100;
  padding: 4px 0;
}
.section-tab-dropdown.open .tab-dropdown-menu {
  display: block;
}
.tab-dropdown-item {
  display: block;
  padding: 8px 16px;
  color: var(--color-text-muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.tab-dropdown-item:hover {
  background: var(--color-bg-muted, rgba(0,0,0,0.04));
  text-decoration: none;
}
.tab-dropdown-item.active {
  color: var(--color-text);
  font-weight: 600;
}

/* === Container === */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* === Repo Header === */
.repo-header { margin-bottom: 16px; }
.repo-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

/* === Back Link === */
.back-link {
    font-size: 14px;
    margin-bottom: 8px;
    padding: 4px 0;
}
.back-link a { color: var(--color-link); }

/* === File Table === */
.file-table-container {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}
.file-table-container.scrollable-dir-list {
    max-height: 330px;
    overflow-y: auto;
}
.region-badge {
    display: inline-block;
    font-size: 11px;
    padding: 1px 6px;
    margin-right: 4px;
    border-radius: 3px;
    background: var(--color-border);
    color: var(--color-text-muted);
    vertical-align: middle;
}
.file-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}
.file-table thead tr {
    background: var(--color-bg-muted);
}
.file-table th {
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.file-table td {
    padding: 8px 16px;
    vertical-align: middle;
}
.file-table tbody tr {
    border-bottom: 1px solid var(--color-border);
}
.file-table tbody tr:last-child {
    border-bottom: none;
}
.file-table tbody tr:hover {
    background: var(--color-bg-muted);
}
.file-table tbody tr.row-clickable {
    cursor: pointer;
}
.col-name {
    display: flex;
    align-items: center;
    gap: 8px;
}
/* For th, don't use flex */
th.col-name { display: table-cell; }
.search-input-mini {
    width: 140px; padding: 3px 8px; font-size: 12px;
    border: 1px solid var(--color-border); border-radius: 4px;
    background: var(--color-bg); color: var(--color-text);
    outline: none;
}
.search-input-mini:focus { border-color: var(--color-link); }
@media (max-width: 600px) {
    .search-input-mini { width: 100px; font-size: 11px; }
    .dir-breadcrumb { display: none; }
}
.view-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 4px;
    color: var(--color-text-muted); text-decoration: none;
    border: 1px solid transparent; cursor: pointer;
}
.view-toggle:hover { background: var(--color-bg-secondary, #f6f8fa); color: var(--color-text); }
.view-toggle.active { border-color: var(--color-border); color: var(--color-link); background: var(--color-bg); cursor: default; }
.col-time {
    white-space: nowrap;
    color: var(--color-text-muted);
    font-size: 12px;
}
.icon-dir, .icon-file {
    flex-shrink: 0;
}
.col-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.col-fav {
  width: 64px;
  text-align: center;
  white-space: nowrap;
}
.inline-time {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 400;
  margin-left: 4px;
}

/* === Badge === */
.badge {
    display: inline-block;
    background: var(--color-badge-bg);
    color: var(--color-badge-text);
    font-size: 12px;
    font-weight: 500;
    padding: 0 7px;
    border-radius: 24px;
    border: 1px solid var(--color-badge-border);
    line-height: 20px;
    margin-left: 4px;
    vertical-align: middle;
}

/* === Report Preview === */
.report-preview {
    margin-top: 24px;
}
.preview-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}
#report-frame,
.file-frame-container iframe {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    height: 600px;
    background: var(--color-iframe-bg);
}

/* === Report Hub（报告中心 · 卡片式） === */
.report-hub-head {
    margin: 2px 0 18px;
}
.report-hub-head h1 {
    font-size: 19px;
    font-weight: 700;
    margin: 0 0 3px;
    color: var(--color-text);
}
.report-hub-head p {
    font-size: 12.5px;
    color: var(--color-text-muted);
    margin: 0;
}
.report-section {
    margin-bottom: 22px;
}
.report-section-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--color-text);
    border-left: 3px solid var(--color-text-muted);
    padding-left: 8px;
}
.report-section-count {
    color: var(--color-text-muted);
    font-size: 0.85em;
    font-weight: 400;
    margin-left: 6px;
}
.report-empty-note {
    font-size: 13px;
    color: var(--color-text-muted);
    padding: 4px 2px;
    margin: 0;
}
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(204px, 1fr));
    gap: 12px;
}
.report-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 13px 15px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    transition: border-color .13s ease, box-shadow .13s ease;
}
.report-card:hover {
    border-color: var(--color-link);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
    text-decoration: none;
}
.report-card:hover .report-card-title,
.report-card:hover .report-card-meta {
    text-decoration: none;
}
/* 整卡覆盖链接（模型卡片专用；其余卡片本身即 <a>） */
.report-card-cover {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 8px;
}
.report-card-titlerow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.report-tag {
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .3px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
}
.report-tag--model { background: #2563EB; }
.report-tag--demo  { background: #0E9F6E; }
.report-card-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.35;
    word-break: break-word;
}
.report-card-title--sm {
    font-size: 12.5px;
    font-weight: 500;
}
.report-card-desc {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.report-card-meta {
    font-size: 12px;
    color: var(--color-text-muted);
}
.report-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
    position: relative;
    z-index: 2;
    pointer-events: none;
}
.report-chip {
    font-size: 11.5px;
    padding: 2px 9px;
    border-radius: 5px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-muted);
    text-decoration: none;
    white-space: nowrap;
    pointer-events: auto;
}
.report-chip:hover {
    border-color: var(--color-link);
    color: var(--color-link);
}
.report-legacy-toggle {
    margin-top: 12px;
    font-size: 13px;
    color: var(--color-link);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
}
.report-legacy-grid { margin-top: 10px; }
@media (max-width: 600px) {
    .report-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .report-card { padding: 11px 12px; }
}
@media (max-width: 380px) {
    .report-grid { grid-template-columns: 1fr; }
}

/* === Markdown Body === */
.markdown-body {
    padding: 24px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    word-wrap: break-word;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}
.markdown-body h1 { font-size: 2em; padding-bottom: 0.3em; border-bottom: 1px solid var(--color-border); }
.markdown-body h2 { font-size: 1.5em; padding-bottom: 0.3em; border-bottom: 1px solid var(--color-border); }
.markdown-body h3 { font-size: 1.25em; }
.markdown-body p { margin-top: 0; margin-bottom: 16px; }
.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
}
.markdown-body table th,
.markdown-body table td {
    padding: 6px 13px;
    border: 1px solid var(--color-border);
}
.markdown-body table th {
    font-weight: 600;
    background: var(--color-bg-muted);
}
.markdown-body table tr:nth-child(2n) {
    background: var(--color-bg-muted);
}
.markdown-body code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background: var(--color-code-bg);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
.markdown-body pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background: var(--color-bg-muted);
    border-radius: 6px;
}
.markdown-body pre code {
    padding: 0;
    background: transparent;
    border-radius: 0;
}
.markdown-body ul, .markdown-body ol {
    padding-left: 2em;
    margin-bottom: 16px;
}
.markdown-body li + li { margin-top: 4px; }
.markdown-body blockquote {
    padding: 0 1em;
    color: var(--color-blockquote);
    border-left: 0.25em solid var(--color-blockquote-border);
    margin: 0 0 16px;
}

/* SVG 图标颜色（配合 fill="currentColor"） */
.icon-dir { color: var(--color-icon-dir); }
.icon-file { color: var(--color-icon-file); }
.file-current .icon-file { color: var(--color-link); }

/* Dark 主题：文件表格链接默认文本色，hover 变蓝+下划线 */
[data-theme="dark"] .file-table a {
  color: var(--color-text);
}
[data-theme="dark"] .file-table a:hover {
  color: var(--color-link);
  text-decoration: underline;
}
[data-theme="dark"] .file-table-container {
  background: var(--color-iframe-bg);
}
[data-theme="dark"] .auth-card {
  background: var(--color-iframe-bg);
}
[data-theme="dark"] .chart-box {
  background: var(--color-iframe-bg);
}
[data-theme="dark"] .fund-chart-box {
  background: var(--color-iframe-bg);
}
[data-theme="dark"] .user-menu-dropdown {
  background: var(--color-iframe-bg);
}
[data-theme="dark"] .back-to-top {
  background: var(--color-iframe-bg);
}

/* === Theme Toggle === */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-header-muted);
  border-radius: 6px;
  color: var(--color-header-text);
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  transition: border-color 0.2s;
}
.theme-toggle:hover {
  border-color: var(--color-header-text);
}

/* === Chart & Data Section === */
.chart-section {
  margin-bottom: 24px;
}
.chart-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--color-text);
}
.chart-box {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  position: relative;
  z-index: 0;
}
.data-table-details {
  margin-top: 8px;
}
.data-table-details summary {
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 13px;
  padding: 4px 0;
}
.data-table-details summary:hover {
  color: var(--color-link);
}
.data-table-scroll {
  border: 1px solid var(--color-border);
  border-radius: 6px;
}
.browse-all-link {
  font-size: 14px;
  color: var(--color-link);
  text-decoration: none;
}
.browse-all-link:hover {
  text-decoration: underline;
}

/* === Header Right (theme + user menu) === */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === User Menu === */
.user-menu {
  position: relative;
}
.user-menu-btn {
  background: none;
  border: 1px solid var(--color-header-muted);
  border-radius: 6px;
  color: var(--color-header-text);
  cursor: pointer;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  transition: border-color 0.2s;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-btn:hover {
  border-color: var(--color-header-text);
}
.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 150px;
  z-index: 100;
  padding: 4px 0;
}
.user-menu-dropdown.open {
  display: block;
}
.user-menu-dropdown a {
  display: block;
  padding: 8px 16px;
  color: var(--color-text);
  font-size: 13px;
  text-decoration: none;
}
.user-menu-dropdown a:hover {
  background: var(--color-bg-muted);
  text-decoration: none;
}
.user-menu-dropdown hr {
  margin: 4px 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

/* === Auth Forms === */
.auth-card {
  max-width: 400px;
  margin: 48px auto;
  padding: 32px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
}
.auth-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 16px;
  text-align: center;
  color: var(--color-text);
}
.auth-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  margin: 0 0 16px;
  font-size: 14px;
}
.auth-form {
  display: flex;
  flex-direction: column;
}
.auth-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
  margin-top: 12px;
}
.auth-label:first-of-type {
  margin-top: 0;
}
.auth-input {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s;
}
.auth-input:focus {
  border-color: var(--color-link);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}
.auth-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.pw-wrapper {
  position: relative;
}
.pw-wrapper .auth-input {
  width: 100%;
  box-sizing: border-box;
}
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
}
.pw-toggle:hover {
  color: var(--color-text);
}
.auth-btn {
  margin-top: 20px;
  padding: 10px 16px;
  background: var(--color-link);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.auth-btn:hover {
  opacity: 0.9;
}
/* Auth Tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}
.auth-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.auth-tab:hover {
  color: var(--color-text);
}
.auth-tab.active {
  color: var(--color-link);
  border-bottom-color: var(--color-link);
  font-weight: 600;
}
/* SMS row */
.sms-row {
  display: flex;
  gap: 8px;
}
.sms-row .auth-input {
  flex: 1;
  min-width: 0;
}
.sms-btn {
  white-space: nowrap;
  padding: 8px 14px;
  border: 1px solid var(--color-link);
  border-radius: 6px;
  background: none;
  color: var(--color-link);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.sms-btn:hover:not(:disabled) {
  background: var(--color-bg-highlight);
}
.sms-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.sms-coming-soon {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 0 0 12px;
}
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}
.flash-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.flash-success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}
[data-theme="dark"] .flash-error {
  background: #2a1215;
  color: #f87171;
  border-color: #3d1f22;
}
[data-theme="dark"] .flash-success {
  background: #0f2a1e;
  color: #6ee7b7;
  border-color: #1a3d2e;
}
[data-theme="paper"] .flash-error {
  background: #fdf2e9;
  color: #b91c1c;
  border-color: #f0d5c0;
}
[data-theme="paper"] .flash-success {
  background: #f0f5e9;
  color: #15803d;
  border-color: #d5e0c0;
}

/* === Profile === */
.profile-info {
  margin-top: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
}
.profile-info p {
  margin: 6px 0;
  font-size: 13px;
  color: var(--color-text-muted);
}
.profile-label {
  color: var(--color-text);
  font-weight: 600;
}

/* === Invite === */
.invite-notice {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
  margin: 0 0 20px;
}
.invite-link-row {
  display: flex;
  gap: 8px;
}
.invite-link-input {
  flex: 1;
  min-width: 0;
}
.invite-copy-btn {
  margin-top: 0;
  padding: 8px 16px;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}
.invite-copy-btn.copied {
  background: #16a34a;
  transform: scale(1.05);
}
[data-theme="dark"] .invite-copy-btn.copied {
  background: #6ee7b7;
}
[data-theme="paper"] .invite-copy-btn.copied {
  background: #15803d;
}
.invite-used {
  margin-top: 12px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

/* === Favorite Star === */
.favorite-star {
  cursor: pointer;
  color: var(--color-text-muted);
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
  margin-left: 8px;
  vertical-align: middle;
}
.favorite-star:hover {
  opacity: 0.8;
  color: #d4a017;
}
.favorite-star.active {
  opacity: 1;
  color: #d4a017;
}
.favorite-tooltip {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: var(--color-bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  animation: fadeOut 2s forwards;
}
@keyframes fadeOut {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* === USDA Balance Table === */
.balance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.balance-table-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  margin: 16px 0;
}
.balance-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.balance-table th,
.balance-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
}
.balance-table th:last-child,
.balance-table td:last-child {
  border-right: none;
}
.balance-table thead th {
  background: var(--color-bg-muted);
  font-weight: 600;
}
.balance-year-col {
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--color-bg);
  font-weight: 500;
  min-width: 72px;
  text-align: center;
  border-right: 2px solid var(--color-border) !important;
}
thead .balance-year-col {
  z-index: 3;
  background: var(--color-bg-muted);
}
.balance-unit-row td {
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  font-size: 11px;
  text-align: center;
}
.balance-unit-row .balance-year-col {
  background: var(--color-bg-muted);
  position: -webkit-sticky;
  position: sticky;
  left: 0;
}
.balance-unit-cell {
  text-align: center;
}
.balance-attr-col {
  text-align: center;
  min-width: 80px;
}
.balance-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.btn-show-more {
  padding: 6px 16px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--color-link);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-show-more:hover {
  background: var(--color-bg-muted);
}

/* === "上一级" Row Style === */
.file-table .row-parent td {
  color: var(--color-text-muted);
}
.file-table .row-parent .icon-dir {
  color: var(--color-text-muted);
}
.file-table .row-parent a {
  color: var(--color-text-muted);
}
.file-table .row-parent a:hover {
  color: var(--color-link);
}

/* === "显示更多" Button (block level) === */
.btn-show-more-block {
  display: block;
  margin: 12px auto;
  padding: 6px 16px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--color-link);
  cursor: pointer;
  font-size: 12px;
}
.btn-show-more-block:hover {
  background: var(--color-bg-muted);
}

/* === Dark Theme Scrollbar === */
[data-theme="dark"] {
  color-scheme: dark;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg-muted);
}
::-webkit-scrollbar-thumb {
  background: var(--color-text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text);
}

/* === Mobile === */
@media (max-width: 768px) {
    html { scrollbar-gutter: auto; }
    .site-header {
        position: sticky;
        top: 0;
        z-index: 50;
    }
    .section-tabs {
        position: sticky;
        top: 49px;
        z-index: 49;
    }
    .container { padding: 16px 12px; }
    .section-tabs-inner { padding: 0 12px; overflow: hidden; }
    .section-tab { padding: 8px 10px; }
    .section-tabs-inner.tab-bouncing { transition: transform 0.3s ease; }
    .col-time { display: none; }
    th.col-time { display: none; }
    .col-desc { display: none; }
    th.col-desc { display: none; }
    .col-fav { display: none; }
    th.col-fav { display: none; }
    .file-table th,
    .file-table td { padding: 8px 12px; }
    .markdown-body { padding: 16px; }
    #report-frame,
    .file-frame-container iframe { height: 400px; }

    /* 聊天页固定布局 */
    body.page-chat {
        height: 100dvh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    body.page-chat .site-header {
        flex-shrink: 0;
        position: relative;
        top: auto;
    }
    body.page-chat .section-tabs {
        flex-shrink: 0;
        position: relative;
        top: auto;
    }
    body.page-chat .container {
        padding: 0;
        flex: 1;
        overflow: hidden;
        display: flex;
        min-height: 0;
    }
    body.page-chat .chat-container {
        width: 100%;
        height: auto;
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    body.page-chat .chat-messages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }
    body.page-chat .chat-input-area {
        flex-shrink: 0;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    }
    body.page-chat .back-to-top {
        display: none;
    }
}

/* === Back to Top === */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, color 0.15s, background 0.15s, box-shadow 0.15s;
  z-index: 100;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover {
  color: var(--color-text);
  background: var(--color-bg-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
[data-theme="dark"] .back-to-top {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .back-to-top:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* === Fund (资金流向) === */
.fund-section {
  margin-bottom: 28px;
}
.fund-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.fund-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}
.fund-section-sub {
  font-size: 12px;
  color: var(--color-text-muted);
}
.fund-card {
  background: var(--fund-card-bg);
  border: 1px solid var(--fund-card-border);
  border-radius: 8px;
  padding: 16px 20px;
}
.fund-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.fund-metrics-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.fund-metric-card {
  background: var(--fund-card-bg);
  border: 1px solid var(--fund-card-border);
  border-radius: 8px;
  padding: 14px 16px;
}
.fund-metric-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.fund-metric-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.fund-metric-value.positive { color: var(--fund-positive); }
.fund-metric-value.negative { color: var(--fund-negative); }
.fund-metric-streak {
  font-size: 11px;
  margin-top: 2px;
  color: var(--color-text-muted);
}
.fund-metric-change {
  font-size: 12px;
  margin-top: 2px;
  color: var(--color-text-muted);
}
.fund-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.fund-tabs::-webkit-scrollbar { display: none; }
.fund-tab {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  white-space: nowrap;
}
.fund-tab:hover { color: var(--color-text); }
.fund-tab.active {
  color: var(--color-text);
  font-weight: 600;
  border-bottom-color: var(--color-link);
}
.fund-tab-content { display: none; }
.fund-tab-content.active { display: block; }
.fund-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.fund-table th {
  background: var(--color-bg-muted);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.fund-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}
.fund-table tbody tr:last-child td { border-bottom: none; }
.fund-table tbody tr:hover { background: var(--color-bg-muted); }
.fund-table .col-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.fund-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.fund-chart-box {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  padding: 4px;
  position: relative;
  z-index: 0;
}
.fund-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 12px;
  font-weight: 500;
}
.fund-tag-in { background: rgba(22, 163, 74, 0.1); color: var(--fund-negative); }
.fund-tag-out { background: rgba(220, 38, 38, 0.1); color: var(--fund-positive); }
.fund-tag-hold { background: var(--color-bg-muted); color: var(--color-text-muted); }
[data-theme="dark"] .fund-tag-in { background: rgba(110, 231, 183, 0.15); }
[data-theme="dark"] .fund-tag-out { background: rgba(248, 113, 113, 0.15); }
/* PR-D1→SP-3 自产代表性徽章 chip：文字 chip → 金/银/铜/中性图标 chip（信息性，客观历史榜单，
   无投资建议配色；区别于加仓红/减仓绿的 fund-tag）。::before 奖章图标经 mask 由 tier 主色着色；
   列表行徽章（带 data-*，SP-4 委托）与 modal 头部 #holders-badge（display-only）共用本类。
   纯视觉 + 数据载体，role/tabindex/cursor 由 SP-4 加（本阶段不出，防假按钮）。 */
.f13f-badge {
  --f13f-badge-medal: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12%202l2.9%206.26%206.85.66-5.16%204.57%201.55%206.7L12%2017.6l-6.14%203.59%201.55-6.7L2.25%208.92l6.85-.66z'/%3E%3C/svg%3E");
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  font-size: 11px;
  line-height: 1.4;
  padding: 1px 8px 1px 6px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border, rgba(120, 120, 120, 0.25));
}
.f13f-badge::before {
  content: "";
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask: var(--f13f-badge-medal) center / contain no-repeat;
          mask: var(--f13f-badge-medal) center / contain no-repeat;
}
.f13f-badge:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }   /* SP-4 加 tabindex 后生效 */
.f13f-badge[data-dim] { cursor: pointer; }   /* SP-4：仅列表行可点徽章带手型；#holders-badge 无 data-dim 不变 */
.f13f-badge-gold    { background: rgba(202, 138, 4, 0.12);   color: #92610a; border-color: rgba(202, 138, 4, 0.30); }
.f13f-badge-silver  { background: rgba(148, 163, 184, 0.18); color: #6b7280; border-color: rgba(148, 163, 184, 0.38); }
.f13f-badge-bronze  { background: rgba(168, 124, 76, 0.16); color: #9a6c44; border-color: rgba(168, 124, 76, 0.32); }
.f13f-badge-neutral { background: var(--color-bg-muted); color: var(--color-text-muted); border-color: var(--color-border, rgba(120, 120, 120, 0.25)); }
[data-theme="dark"] .f13f-badge { background: var(--color-bg-muted); color: var(--color-text-muted); border-color: var(--color-border, rgba(160, 160, 160, 0.25)); }
[data-theme="dark"] .f13f-badge-gold    { background: rgba(234, 179, 8, 0.16);  color: #e7c66b; border-color: rgba(234, 179, 8, 0.32); }
[data-theme="dark"] .f13f-badge-silver  { background: rgba(203, 213, 225, 0.16); color: #e2e8f0; border-color: rgba(203, 213, 225, 0.34); }
[data-theme="dark"] .f13f-badge-bronze  { background: rgba(180, 120, 70, 0.16); color: #cda57c; border-color: rgba(180, 120, 70, 0.32); }
[data-theme="dark"] .f13f-badge-neutral { background: var(--color-bg-muted); color: var(--color-text-muted); border-color: var(--color-border, rgba(160, 160, 160, 0.25)); }
/* 窄屏(≤768)：可点徽章 [data-dim] 收成金银铜图标(藏文字留奖章 chip)；单击仍开榜单
   (全称+释义在榜单窗口顶部)。只读 #holders-badge 无 data-dim 不受影响。 */
@media (max-width: 768px) {
  .f13f-badge[data-dim] { font-size: 0; gap: 0; padding: 3px 7px; }
  .f13f-badge[data-dim]::before { width: 13px; height: 13px; }
}
.fund-empty {
  text-align: center;
  padding: 32px;
  color: var(--color-text-muted);
  font-size: 14px;
}
.fund-highlight-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 12px;
}
.fund-highlight-val {
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.fund-highlight-label {
  font-size: 13px;
  color: var(--color-text-muted);
}
/* === 配置全景卡片 === */
.fund-overview-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fund-overview-card {
  background: var(--fund-card-bg);
  border: 1px solid var(--fund-card-border);
  border-radius: 8px;
  padding: 14px 16px;
}
.fund-overview-val {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin: 4px 0 2px;
}
.fund-overview-change {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
}
.fund-overview-change.positive { color: var(--fund-positive); }
.fund-overview-change.negative { color: var(--fund-negative); }
.fund-overview-arrow { margin-right: 2px; }
.fund-overview-tag {
  font-size: 11px;
  color: var(--color-text-muted);
  background: var(--color-bg-muted);
  padding: 1px 8px;
  border-radius: 12px;
}
/* === 时间线 === */
.fund-timeline { position: relative; }
.fund-timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}
.fund-timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: var(--color-border);
}
.fund-timeline-item:last-child { padding-bottom: 0; }
.fund-timeline-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--color-link);
  flex-shrink: 0;
  margin-top: 3px;
}
.fund-timeline-dot.dot-tic { background: #f87171; }
.fund-timeline-dot.dot-ipo { background: #fbbf24; }
.fund-timeline-dot.dot-sec { background: #a78bfa; }
.fund-timeline-date {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.fund-timeline-text {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.4;
}
/* fund sub-navigation */
.fund-sub-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.fund-sub-nav-item {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  transition: all 0.15s;
}
.fund-sub-nav-item:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}
.fund-sub-nav-item.active {
  color: #fff;
  background: var(--color-link);
  border-color: var(--color-link);
}

/* 13F 第三页：季度切换横向滚动 + 标的钻取 modal（fund_13f_detail.html） */
/* 13F info 卡内嵌季度选择器（「更多」展开历史季度，取代横向滚动条） */
.f13f-qlink { color: var(--color-link); text-decoration: none; }
.f13f-qlink.active { font-weight: 600; color: var(--color-text); }
.f13f-qlink:hover { text-decoration: underline; }
.f13f-more-toggle { margin-left: 10px; color: var(--color-text-muted); cursor: pointer; font-size: 12px; user-select: none; }
.f13f-more-toggle:hover { color: var(--color-text); }
.f13f-qlist { display: none; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.f13f-qlist.open { display: block; }
.f13f-qlist .f13f-qlink { display: block; padding: 4px 0; font-size: 13px; }

.f13f-security-link { cursor: pointer; border-bottom: 1px dashed var(--color-text-muted); }
.f13f-security-link:hover { color: var(--color-link); border-bottom-color: var(--color-link); }

.f13f-modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  align-items: center; justify-content: center;
  padding: 16px;
}
.f13f-modal-overlay.open { display: flex; }
.f13f-modal {
  background: var(--fund-card-bg); border: 1px solid var(--fund-card-border);
  border-radius: 10px; width: 100%; max-width: 520px; max-height: 82vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.f13f-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--color-border);
}
.f13f-modal-title { font-size: 15px; font-weight: 600; color: var(--color-text); }
.f13f-modal-sub { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.f13f-modal-close {
  background: none; border: none; color: var(--color-text-muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.f13f-modal-close:hover { color: var(--color-text); }
.f13f-modal-body { overflow-y: auto; padding: 8px 16px 16px; }
.f13f-modal-loading { text-align: center; color: var(--color-text-muted); padding: 24px 0; font-size: 13px; }
/* SP-3 B：holders-modal 顶部价格大图（三入口共享）。容器随渲染显隐，不占布局。 */
.f13f-modal-price { padding: 10px 16px 0; }
.f13f-modal-price .fund-chart-box { padding: 4px; }
.f13f-price-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; min-height: 60px; color: var(--color-text-muted); font-size: 12px;
}
@media (max-width: 768px) {
  .f13f-modal-price { padding: 8px 12px 0; }
  .f13f-modal-price .fund-chart-box { height: 160px !important; }
}

/* SP-4 榜单窗口（board 模式）：释义区 + roster 行（hover / 选中 / 无价灰置 / focus）。 */
.f13f-board-desc {
  padding: 10px 16px; font-size: 12px; line-height: 1.6;
  color: var(--color-text-muted); border-bottom: 1px solid var(--color-border);
}
.f13f-board-row { cursor: pointer; }
.f13f-board-row:hover { background: var(--color-bg-muted); }
.f13f-board-row.f13f-board-row-active { background: var(--color-bg-muted); }
.f13f-board-row.f13f-board-row-active td:first-child { box-shadow: inset 2px 0 0 var(--color-link); }
.f13f-board-row.f13f-board-row-disabled { cursor: default; opacity: 0.5; }
.f13f-board-row.f13f-board-row-disabled:hover { background: transparent; }
.f13f-board-row:focus-visible { outline: 2px solid var(--color-link); outline-offset: -2px; }
.f13f-board-issuer { font-size: 10px; color: var(--color-text-muted); margin-left: 6px; }

/* 13F 机构概况卡（label-value 表，fund_13f_detail.html） */
.f13f-info-table td { border-bottom: 1px solid var(--color-border); padding: 8px 4px; font-size: 13px; vertical-align: top; }
.f13f-info-table tr:last-child td { border-bottom: none; }
.f13f-info-label { color: var(--color-text-muted); width: 96px; white-space: nowrap; }

/* fund rank — 期货排名页色系（中国习惯：涨红跌绿） */
.rank-positive { color: var(--fund-positive) !important; }  /* 净多增=红 */
.rank-negative { color: var(--fund-negative) !important; }  /* 净空增=绿 */

/* 品种详情 — 三列排名 */
.rank-three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rank-col-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--color-text); }
.fund-table-compact { font-size: 12px; }
.fund-table-compact th, .fund-table-compact td { padding: 3px 6px; }

/* 13F sparkline — 近 1 年走势 SSR inline SVG（涨红跌绿见 CHART_RULES §1.1） */
.f13f-spark { display: inline-block; width: 88px; height: 24px; vertical-align: middle; }
.f13f-spark-th { width: 100px; text-align: center; white-space: nowrap; }
.f13f-spark-cell { text-align: center; white-space: nowrap; }
.fund-table td.empty { color: var(--color-text-muted); text-align: center; }
@media (max-width: 768px) {
  .f13f-spark { width: 64px; height: 20px; }
  .f13f-spark-th { width: 72px; }
}

/* 13F 排行榜表 — 明星卡 + C 卡三榜共享列模型（SP-8 第3次重做：消 SP-6挤右 / SP-7两表不齐）。
   table-layout:fixed + 共享 colgroup（width 落 <col>）+ max-width 左对齐 + width:100%
   → 两卡同左同宽、各列宽跨卡严格一致。单指标榜（C②③）用 aria-hidden 空占位 td 补到 5 列
   同构（单指标固定右槽，与明星卡「合计市值」同位 → 数字跨卡有对齐锚点；空槽正常 metric-w
   宽，不拉宽单列）。nowrap/对齐落实际 th/td（white-space 对 <col> 无效，codex#2）。
   手机端 .fund-card overflow-x:auto 横滑 + 表 min-width 保列宽可读不缩列。*/
.f13f-rank-table {
  table-layout: fixed;
  width: 100%;
  max-width: 920px;
  margin-inline: 0;            /* left 对齐（非居中），超宽屏右侧留白 */
  --f13f-idx-w: 2.5rem;
  --f13f-metric-w: 10rem;      /* 实测最长表头「合计持仓市值（美元）」10 全角字×12px=120px
                                  + th padding 20px ≈ 140px；10rem=160px 单行不裁切（codex 留余量）*/
  --f13f-spark-w: 104px;       /* 近1年：SVG 88px + 余白；手机 76px */
}
.f13f-rank-table .f13f-col-idx    { width: var(--f13f-idx-w); }
.f13f-rank-table .f13f-col-name   { width: auto; }     /* 吸收剩余，受 max-width 约束有界 */
.f13f-rank-table .f13f-col-metric { width: var(--f13f-metric-w); }
.f13f-rank-table .f13f-col-spark  { width: var(--f13f-spark-w); }
.f13f-rank-table th.f13f-th-metric,
.f13f-rank-table td.f13f-td-metric { white-space: nowrap; text-align: right; }
.f13f-rank-table th, .f13f-rank-table td { overflow: hidden; }  /* 防溢出串列 */
@media (max-width: 768px) {
  .f13f-rank-table { min-width: 560px; --f13f-spark-w: 76px; }
}

/* 13F 被动巨头折叠区（SP-9：主表只主动，被动巨头折叠不计主动排名） */
.f13f-passive-details {
  border: 1px solid var(--color-border); border-radius: 8px; padding: 8px 12px;
}
.f13f-passive-summary {
  cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--color-text-muted); list-style-position: inside; user-select: none;
}
.f13f-passive-summary:hover { color: var(--color-text); }
.f13f-passive-details[open] .f13f-passive-summary { margin-bottom: 4px; }

/* 13F 被动表「合并展示」行（PR-E：Vanguard 10 子主体 → 先锋(合计)，点击展开子主体） */
.f13f-merge-row { cursor: pointer; }
.f13f-merge-row:hover { background: rgba(127, 127, 127, 0.06); }
.f13f-merge-caret {
  display: inline-block; width: 1em; color: var(--color-text-muted);
  font-size: 11px; user-select: none;
}
.f13f-merge-sub { background: rgba(127, 127, 127, 0.03); }
.f13f-merge-sub:hover { background: rgba(127, 127, 127, 0.08); }

/* 13F C 卡 — 持仓异动多口径 segmented 切换（SP-4） */
.f13f-seg {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 12px;
  background: var(--color-bg-muted); border-radius: 8px;
}
.f13f-seg-btn {
  border: none; background: transparent; cursor: pointer;
  padding: 6px 14px; font-size: 13px; border-radius: 6px;
  color: var(--color-text-muted); white-space: nowrap;
  transition: background .15s, color .15s;
}
.f13f-seg-btn:hover { color: var(--color-text); }
.f13f-seg-btn.is-active {
  background: var(--color-bg); color: var(--color-text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.f13f-rising-panel[hidden],
.f13f-declining-panel[hidden] { display: none; }
.f13f-rising-empty {
  text-align: center; color: var(--color-text-muted);
  padding: 28px 0; font-size: 13px;
}
.f13f-rising-note {
  margin-top: 8px; font-size: 11px; color: var(--color-text-muted); line-height: 1.5;
}
@media (max-width: 768px) {
  .f13f-seg { display: flex; width: 100%; }
  .f13f-seg-btn { flex: 1; padding: 6px 6px; font-size: 12px; text-align: center; }
}

/* 13F 详情页本季亮点摘要卡（PR-C：左增持 / 右减持 各 Top-N） */
.f13f-hl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.f13f-hl-col { min-width: 0; }
.f13f-hl-col:first-child { padding-right: 16px; }
.f13f-hl-col:last-child { padding-left: 16px; }
/* 竖分界线从第一行标的起（不含标题行）：挂右列 list 上，负 margin 拉回正中对齐 50% */
.f13f-hl-col:last-child .f13f-hl-list { border-left: 1px solid var(--color-border); margin-left: -16px; padding-left: 16px; }
.f13f-hl-coltitle {
  font-size: 13px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 8px;
}
.f13f-hl-list { list-style: none; margin: 0; padding: 0; }
.f13f-hl-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 13px;
}
.f13f-hl-item:last-child { border-bottom: none; }
.f13f-hl-name { color: var(--color-text-muted); font-size: 12px; margin-left: 6px; }
/* 标的名过长 nowrap+省略号；徽章不收缩，让名字吸收挤压(防半宽列中文名换行 万事达→万事/达) */
.f13f-hl-item .f13f-security-link { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.f13f-hl-item .f13f-badge { flex-shrink: 0; }
.f13f-hl-meta { display: flex; align-items: center; gap: 8px; white-space: nowrap; flex-shrink: 0; }
.f13f-hl-amt { color: var(--color-text); font-variant-numeric: tabular-nums; }
.f13f-hl-est { color: var(--color-text-muted); font-size: 10px; margin-left: 3px; }
@media (max-width: 768px) {
  .f13f-hl-grid { grid-template-columns: 1fr; gap: 0; }
  .f13f-hl-col:first-child { padding-right: 0; padding-bottom: 16px; }
  .f13f-hl-col:last-child { padding-left: 0;
    padding-top: 16px; border-top: 1px solid var(--color-border); }
  .f13f-hl-col:last-child .f13f-hl-list { border-left: none; margin-left: 0; padding-left: 0; }
}
/* PR-C3 本季亮点「显示全部」：卡片只显 Top-N，全部增/减持点开榜单弹窗(复用 #holders-modal) */
.f13f-hl-showall-wrap { margin-top: 8px; }
.f13f-hl-showall {
  display: inline-block; font-size: 12px; color: var(--color-link, #2563eb);
  cursor: pointer; border-bottom: 1px dashed transparent;
}
.f13f-hl-showall:hover { border-bottom-color: var(--color-link, #2563eb); }
.f13f-board-tag { margin-left: 6px; }

/* 新进/退出标签 */
.rank-tag { display: inline-block; font-size: 10px; padding: 1px 4px; border-radius: 3px; margin-left: 4px; vertical-align: middle; }
.rank-tag-new { background: var(--fund-negative); color: #fff; }
.rank-tag-danger { background: var(--fund-positive); color: #fff; }
.rank-tag-warn { background: #e8a838; color: #fff; }

/* 联动分析行高亮 */
.rank-row-danger { background: rgba(255, 77, 79, 0.08); }
.rank-row-warn { background: rgba(232, 168, 56, 0.06); }

/* Tab 切换按钮 */
.fund-tab-btn {
  background: var(--color-bg-elevated); color: var(--color-text-muted);
  border: 1px solid var(--color-border); border-radius: 6px;
  padding: 4px 12px; font-size: 12px; cursor: pointer;
}
.fund-tab-btn.active {
  background: var(--fund-accent, #5470c6); color: #fff;
  border-color: var(--fund-accent, #5470c6);
}

@media (max-width: 768px) {
  .fund-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .fund-two-col { grid-template-columns: 1fr; }
  .fund-overview-cards { grid-template-columns: 1fr 1fr; }
  .fund-card { overflow-x: auto; overscroll-behavior-x: contain; }
  .fund-metric-card { overflow: hidden; }
  .fund-metric-value { font-size: 16px; }
  .fund-overview-val { font-size: 16px; }
  .rank-three-col { grid-template-columns: 1fr; }
}

/* === Chat — 小玉助手 === */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-width: 800px;
  margin: 0 auto;
  padding: 0;
}

.chat-disabled {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--color-text-muted);
  font-size: 16px;
}

/* header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}
.chat-header-left { display: flex; align-items: baseline; gap: 8px; }
.chat-quota-warning {
  padding: 6px 16px;
  font-size: 12px;
  text-align: center;
}
.chat-quota-warning.quota-low {
  color: var(--color-text-muted);
  background: transparent;
}
.chat-quota-warning.quota-exhausted {
  color: #dc2626;
  background: var(--color-bg-muted);
  font-weight: 500;
}
.chat-title { margin: 0; font-size: 18px; font-weight: 600; }
.chat-subtitle { color: var(--color-text-muted); font-size: 13px; }
.chat-action-btn {
  background: none; border: 1px solid var(--color-border); border-radius: 6px;
  color: var(--color-text-muted); padding: 4px 8px; cursor: pointer;
}
.chat-action-btn:hover { color: var(--color-text); border-color: var(--color-text-muted); }

/* messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
}

/* welcome */
.chat-welcome {
  text-align: center;
  padding: 48px 16px;
  color: var(--color-text-muted);
}
.chat-welcome-icon { font-size: 40px; margin-bottom: 12px; }
.chat-welcome h3 { margin: 0 0 8px; color: var(--color-text); font-size: 20px; }
.chat-welcome p { margin: 0 0 24px; font-size: 14px; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chat-suggestion {
  background: var(--color-bg-muted); border: 1px solid var(--color-border);
  border-radius: 16px; padding: 6px 14px; font-size: 13px;
  color: var(--color-text); cursor: pointer; transition: background 0.15s;
}
.chat-suggestion:hover { background: var(--color-bg-highlight); }
.chat-suggestions-row { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
/* spacer：撑开消息和提示词泡泡之间的空间 */
.chat-suggestions-spacer { flex-shrink: 0; }
/* hint 覆盖层 */
.chat-pull-overlay {
  position: relative;
  height: 0;
  overflow: visible;
  z-index: 5;
  pointer-events: none;
}
.chat-pull-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
/* 底部建议泡泡 — 紧凑横排 */
.chat-bottom-suggestions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 12px 2px;
  margin-top: 16px;
  margin-bottom: 12px;
  flex-wrap: nowrap;
}
.chat-bottom-suggestions .suggestions-loading {
  font-size: 12px;
  color: var(--color-text-muted);
}
.chat-bottom-suggestions .chat-suggestion {
  font-size: 12px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* header actions (subscription icons + clear) */
.chat-header-actions { display: flex; align-items: center; gap: 6px; }
.chat-sub-icon-btn {
  position: relative; transition: all 0.2s;
}
.chat-sub-icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-sub-icon-btn.chat-sub-active {
  background: var(--color-bg-highlight); border-color: var(--color-link); color: var(--color-link);
}

/* message bubbles */
.chat-msg { display: flex; margin-bottom: 12px; max-width: 100%; overflow: hidden; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-assistant { justify-content: flex-start; }
.chat-bubble {
  max-width: 80%;
  min-width: 0;
  padding: 8px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  position: relative;
  word-break: break-word;
  overflow: hidden;
}
.chat-msg-user .chat-bubble {
  background: var(--color-link);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-assistant .chat-bubble {
  background: var(--color-bg-muted);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}

/* typing indicator */
.chat-typing::after {
  content: '▌';
  animation: chat-blink 0.8s infinite;
}
@keyframes chat-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* video progress bar */
.chat-progress { padding: 8px 0 4px; }
.chat-progress-bar {
  width: 100%; height: 8px;
  background: var(--color-bg-muted); border-radius: 4px;
  overflow: hidden; margin-bottom: 6px;
}
.chat-progress-fill {
  display: block; height: 100%;
  background: var(--color-link); border-radius: 4px;
  transition: width 0.6s ease;
}
.chat-progress-fill.chat-progress-active {
  background-image: linear-gradient(
    -45deg,
    rgba(255,255,255,.2) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,.2) 50%,
    rgba(255,255,255,.2) 75%, transparent 75%
  );
  background-size: 16px 16px;
  animation: progress-stripe 0.6s linear infinite;
}
@keyframes progress-stripe {
  from { background-position: 16px 0; }
  to   { background-position: 0 0; }
}
.chat-progress-text { font-size: 0.85em; color: var(--color-text-muted); margin-top: 2px; }

/* error text */
.chat-error { color: #dc2626; }
[data-theme="dark"] .chat-error,
[data-theme="fund"] .chat-error { color: #f87171; }

.chat-msg-content { min-width: 0; max-width: 100%; overflow: hidden; }

/* chat table */
.chat-chart-img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; cursor: pointer; }
.chat-chart-img:hover { opacity: 0.9; }
.chat-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0; overscroll-behavior-x: contain; }
.chat-table { border-collapse: separate; border-spacing: 0; font-size: 12px; white-space: nowrap; }
.chat-table th, .chat-table td { border: 1px solid var(--color-border, #d0d7de); padding: 4px 8px; text-align: left; }
.chat-table th { background: var(--color-bg-muted, #f6f8fa); font-weight: 600; }
.chat-table tr:nth-child(even) td { background: var(--color-bg-subtle, #f6f8fa22); }
[data-theme="dark"] .chat-table th { background: #1c1d28; }
[data-theme="dark"] .chat-table td { border-color: #2d2e3d; }
[data-theme="dark"] .chat-table tr:nth-child(even) td { background: #14151e; }

/* delete button on bubble */
.chat-msg-delete {
  position: absolute; top: 2px; right: 4px;
  background: none; border: none; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 2px 4px;
  color: transparent; transition: color 0.15s;
}
.chat-bubble:hover .chat-msg-delete { color: var(--color-text-muted); }
.chat-msg-delete:hover { color: var(--color-text); }
.chat-msg-user .chat-msg-delete:hover { color: rgba(255,255,255,0.8); }
.chat-msg-user .chat-bubble:hover .chat-msg-delete { color: rgba(255,255,255,0.5); }

/* code in assistant messages */
.chat-msg-content pre {
  background: var(--color-code-bg); border-radius: 6px;
  padding: 8px 12px; overflow-x: auto; font-size: 13px; margin: 6px 0;
}
.chat-msg-content code {
  background: var(--color-code-bg); padding: 1px 4px; border-radius: 3px; font-size: 13px;
}
.chat-msg-content pre code { background: none; padding: 0; }
.chat-msg-content a {
  color: var(--color-link); text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-msg-content a:hover { opacity: 0.8; }

/* broadcast card styles */
.broadcast { padding: 2px 0; }
.broadcast-header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}
.broadcast-icon { font-size: 24px; flex-shrink: 0; }
.broadcast-title { font-weight: 600; font-size: 15px; color: var(--color-text); }
.broadcast-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.broadcast-section-title {
  font-weight: 600; font-size: 13px; color: var(--color-link);
  margin: 14px 0 8px; padding-left: 10px;
  border-left: 3px solid var(--color-link);
}
.broadcast-card {
  background: var(--color-bg-muted); border: 1px solid var(--color-border);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.broadcast-source {
  display: inline-block; font-size: 11px; font-weight: 500;
  background: var(--color-bg-highlight); color: var(--color-text-muted);
  padding: 1px 8px; border-radius: 10px; margin-bottom: 6px;
}
.broadcast-card-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; color: var(--color-text); }
.broadcast-card-summary { font-size: 13px; line-height: 1.6; color: var(--color-text-secondary); }
.broadcast-link {
  display: inline-block; margin-top: 6px; font-size: 12px;
  color: var(--color-link); text-decoration: none;
}
.broadcast-link:hover { text-decoration: underline; }

/* broadcast inline action buttons */
.chat-action-buttons { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chat-inline-btn {
  padding: 6px 16px; border-radius: 16px; font-size: 13px;
  cursor: pointer; border: 1px solid var(--color-border); transition: all 0.15s;
}
.chat-inline-btn-primary {
  background: var(--color-link); color: #fff; border-color: var(--color-link);
}
.chat-inline-btn-primary:hover { opacity: 0.85; }
.chat-inline-btn-secondary {
  background: var(--color-bg-muted); color: var(--color-text-muted);
}
.chat-inline-btn-secondary:hover { background: var(--color-bg-highlight); }

/* dark theme broadcast overrides */
[data-theme="dark"] .broadcast-card { background: #1a1b26; border-color: #252636; }
[data-theme="dark"] .broadcast-source { background: #252636; color: #8b8d9e; }
[data-theme="dark"] .chat-inline-btn-secondary { background: #1a1b26; border-color: #252636; color: #8b8d9e; }

/* paper theme broadcast overrides */
[data-theme="paper"] .broadcast-card { background: #f3ede4; border-color: #e0d5c4; }
[data-theme="paper"] .broadcast-source { background: #e0d5c4; color: #8a7e6b; }

/* input area */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  max-width: 100%;
  box-sizing: border-box;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}
.chat-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 14px;
  line-height: 1.5;
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  min-height: 38px;
  max-height: 120px;
  font-family: inherit;
}
.chat-input-area textarea:focus { border-color: var(--color-link); }
.chat-send-btn {
  background: var(--color-link); color: #fff; border: none; border-radius: 50%;
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: opacity 0.15s;
}
.chat-send-btn:hover { opacity: 0.85; }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* dark theme overrides */
[data-theme="dark"] .chat-msg-user .chat-bubble {
  background: #2d6a4f;
  color: #e8e6e1;
}
[data-theme="dark"] .chat-msg-assistant .chat-bubble {
  background: #14151e;
}
[data-theme="dark"] .chat-suggestion {
  background: #14151e;
  border-color: #252636;
}
[data-theme="dark"] .chat-suggestion:hover { background: #1c1d28; }
[data-theme="dark"] .chat-refresh-btn { border-color: #252636; color: #8b8d9e; }
[data-theme="dark"] .chat-refresh-btn:hover { background: #1c1d28; color: #c5c7d5; }

/* paper theme */
[data-theme="paper"] .chat-msg-user .chat-bubble {
  background: #8b5e3c;
}

/* mic button */
.chat-mic-btn {
  background: none; border: 1px solid var(--color-border); border-radius: 50%;
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; color: var(--color-text-muted); transition: all 0.2s;
}
.chat-mic-btn:hover { color: var(--color-text); border-color: var(--color-text-muted); }
.chat-mic-recording {
  color: #dc2626; border-color: #dc2626; background: rgba(220,38,38,0.08);
  animation: chat-mic-pulse 1.2s infinite;
}
@keyframes chat-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}
.chat-mic-processing {
  color: var(--color-link); border-color: var(--color-link);
  animation: chat-mic-spin 1s linear infinite;
}
@keyframes chat-mic-spin {
  100% { transform: rotate(360deg); }
}

/* TTS button wrapper — 靠右对齐，放在泡泡右下角 */
.chat-tts-wrap {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 6px;
}
/* TTS play button on assistant bubbles — 放大便于手机点击 */
.chat-tts-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); padding: 8px;
  border-radius: 6px; transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.chat-tts-btn:hover { color: var(--color-text); }
.chat-tts-loading { opacity: 0.7; cursor: wait; }
.chat-tts-btn.chat-tts-playing { color: var(--color-link); }

/* TTS loading indicator */
.chat-tts-indicator {
  display: inline-block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: 6px;
  vertical-align: middle;
}
.tts-dots span {
  animation: tts-dot-blink 1.4s infinite;
  opacity: 0;
}
.tts-dots span:nth-child(1) { animation-delay: 0s; }
.tts-dots span:nth-child(2) { animation-delay: 0.3s; }
.tts-dots span:nth-child(3) { animation-delay: 0.6s; }
@keyframes tts-dot-blink {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

/* TTS playing wave animation */
.chat-tts-playing .tts-wave-inner {
  animation: tts-wave-pulse 1.2s ease-in-out infinite;
}
.chat-tts-playing .tts-wave-outer {
  animation: tts-wave-pulse 1.2s ease-in-out infinite 0.3s;
}
@keyframes tts-wave-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
[data-theme="dark"] .chat-tts-btn { color: #8b949e; }
[data-theme="dark"] .chat-tts-btn:hover { color: #e8e6e1; }
[data-theme="dark"] .chat-tts-btn.chat-tts-playing { color: #6ee7b7; }
[data-theme="dark"] .chat-mic-btn { border-color: #252636; color: #8b949e; }
[data-theme="dark"] .chat-mic-btn:hover { color: #e8e6e1; border-color: #8b949e; }

/* mobile */
@media (max-width: 768px) {
  .chat-container { height: calc(100vh - 110px); }
  .chat-bubble { max-width: 90%; }
  .chat-suggestions { flex-direction: column; align-items: center; }
  .chat-suggestions-row { flex-direction: column; }
  .chat-input-area textarea { font-size: 16px; }
  /* 表格：第一列 sticky，容器强制约束 */
  .chat-table-wrap { max-width: calc(100vw - 90px); }
  .chat-table th:first-child,
  .chat-table td:first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--color-bg-muted, #f6f8fa);
    border-right: 2px solid var(--color-border, #d0d7de);
  }
  .chat-table td:first-child { background: var(--color-bg, #fff); }
  [data-theme="dark"] .chat-table th:first-child { background: #1c1d28; }
  [data-theme="dark"] .chat-table td:first-child { background: #0d1117; }
  [data-theme="paper"] .chat-table th:first-child { background: #f0ead6; }
  [data-theme="paper"] .chat-table td:first-child { background: #faf6eb; }
}

/* ── 播报可折叠卡片 ─────────────────────── */
.broadcast-collapsible-wrap {
  position: relative;
}
.broadcast-collapsible {
  max-height: 280px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.broadcast-expanded .broadcast-collapsible {
  max-height: none;
}
.broadcast-fade {
  height: 60px;
  margin-top: -60px;
  background: linear-gradient(transparent, var(--color-bg-muted, #f6f8fa));
  pointer-events: none;
}
.broadcast-expand-btn {
  display: block;
  width: 100%;
  padding: 8px;
  text-align: center;
  background: var(--color-bg-muted, #f5f5f5);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-link, #4a8);
  margin-top: 4px;
}
.broadcast-expand-btn:hover {
  opacity: 0.8;
}
[data-theme="dark"] .broadcast-fade {
  background: linear-gradient(transparent, #14151e);
}
[data-theme="dark"] .broadcast-expand-btn {
  background: #1a1b26;
  border-color: #252636;
  color: #6ee7b7;
}
[data-theme="paper"] .broadcast-fade {
  background: linear-gradient(transparent, #f3ede4);
}
[data-theme="paper"] .broadcast-expand-btn {
  background: #f3ede4;
  border-color: #e0d5c4;
  color: #8b5e3c;
}

/* ── /admin 管理面板(PLAN-20260527 P1)──────────────────────────────────
   命名空间: .admin-*  /  CSS Variables 沿用 :root + [data-theme] 4 主题   */
.admin-layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px 40px;
}
.admin-nav-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  position: relative;
}
.admin-nav-tab {
  position: relative;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: background .15s, color .15s;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.admin-nav-tab:hover { color: var(--color-text); background: var(--color-bg); }
.admin-nav-tab.is-active {
  color: var(--color-text);
  background: var(--color-bg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.admin-nav-dropdown { position: relative; }
.admin-nav-label { display: inline-flex; align-items: center; gap: 4px; }
.admin-nav-chevron { opacity: 0.6; }
.admin-nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 140px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s;
  z-index: 100;
}
/* 桥接 6px gap:鼠标从 tab 移到 menu 时穿过这段透明区域不会丢 hover */
.admin-nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 6px;
}
.admin-nav-dropdown:hover .admin-nav-dropdown-menu,
.admin-nav-dropdown:focus-within .admin-nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
}
.admin-nav-dropdown-item {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 4px;
}
.admin-nav-dropdown-item:hover { background: var(--color-bg-muted); }

.admin-flash {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  font-size: 13px;
}
.admin-flash p { margin: 0; }

.admin-content { min-height: 200px; }

/* ── 用户管理(/admin/users)──────────────────────────────────────── */
.admin-users-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.admin-section-title { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.admin-section-subtitle { color: var(--color-text-muted); font-size: 13px; margin: 0; }

.admin-group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
}
.admin-group-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.admin-group-tab:hover { color: var(--color-text); }
.admin-group-tab.is-active {
  color: var(--color-text);
  border-bottom-color: var(--color-text);
}
.admin-group-tab--muted { opacity: 0.7; }
.admin-group-tab-count {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  font-size: 11px;
  text-align: center;
  background: var(--color-bg-muted);
  border-radius: 10px;
  color: var(--color-text-muted);
}
.admin-group-tab.is-active .admin-group-tab-count {
  background: var(--color-text);
  color: var(--color-bg);
}

.admin-group-stats {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}
.admin-group-stats strong { color: var(--color-text); font-weight: 600; }

.admin-cleanup-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
}
.admin-cleanup-banner-text { font-size: 13px; flex: 1; }
.admin-cleanup-banner-text code {
  font-size: 12px;
  padding: 1px 5px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 3px;
}
.admin-cleanup-form { margin: 0; flex-shrink: 0; }
.admin-cleanup-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: #dc2626;
  border: 1px solid #b91c1c;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.admin-cleanup-btn:hover { background: #b91c1c; }

.admin-users-table-wrap { overflow-x: auto; }
.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-users-table th,
.admin-users-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.admin-users-table th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  background: var(--color-bg-muted);
}
.admin-users-table tbody tr:hover { background: var(--color-bg-muted); }
.admin-users-table .col-status { width: 32px; text-align: center; }
.admin-users-table .col-time { width: 110px; }
.admin-users-table .col-ip { width: 120px; font-family: ui-monospace, monospace; font-size: 12px; }
.admin-users-table .col-toggle { width: 50px; text-align: center; }
.admin-users-table .col-actions { width: 100px; }

.admin-username { font-weight: 500; }
.admin-muted { color: var(--color-text-muted); }
.admin-status-dot { font-size: 12px; line-height: 1; }
.admin-status-dot--online { color: #16a34a; }
.admin-status-dot--offline { color: var(--color-text-muted); }
.admin-status-dot--unknown { color: var(--color-text-muted); }

.admin-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
  font-weight: 500;
  vertical-align: middle;
}
.admin-badge--admin { background: var(--color-border); color: var(--color-text-muted); }
.admin-badge--link { background: #dbeafe; color: #1d4ed8; cursor: default; }
[data-theme="dark"] .admin-badge--link,
[data-theme="dim"] .admin-badge--link { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }

.admin-toggle-form { margin: 0; display: inline; }
.admin-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
}
.admin-toggle-on { color: #16a34a; }
.admin-toggle-off { color: var(--color-text-muted); }

.admin-action-link {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  text-decoration: none;
  transition: color .15s;
}
.admin-action-link:hover { color: var(--color-text); }
.admin-action-link--danger:hover { color: #dc2626; }

.admin-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 40px 0;
  font-size: 13px;
}

/* ── 系统设置(/admin/system)──────────────────────────────────────── */
.admin-system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.admin-card {
  padding: 16px 18px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}
.admin-card-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.admin-card-subtitle { font-size: 12px; color: var(--color-text-muted); margin: 0 0 12px; }
.admin-form-inline { display: flex; gap: 8px; align-items: center; margin: 0; }
.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}
.admin-form-grid label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.admin-form-grid label span { color: var(--color-text-muted); }
.admin-select, .admin-input {
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--color-text);
}
.admin-select { flex: 1; max-width: 280px; }
.admin-input { width: 100px; text-align: right; }
.admin-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg-muted);
  color: var(--color-text);
  cursor: pointer;
}
.admin-btn:hover { background: var(--color-border); }
.admin-btn--primary {
  background: #0969da;
  border-color: #0860c4;
  color: #fff;
}
.admin-btn--primary:hover { background: #0860c4; }
.admin-btn--success {
  background: #16a34a;
  border-color: #15803d;
  color: #fff;
}
.admin-btn--success:hover { background: #15803d; }
.admin-btn--muted {
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
}

/* ── 用户详情页(/admin/users/<id>, P3)──────────────────────── */
.admin-detail-head { margin-bottom: 20px; }
.admin-detail-back {
  display: inline-block;
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: none;
  margin-bottom: 8px;
}
.admin-detail-back:hover { color: var(--color-text); }
.admin-detail-title-block .admin-section-subtitle code {
  font-size: 11px;
  padding: 1px 5px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  margin-right: 4px;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.admin-card--span-2 { grid-column: 1 / -1; }
.admin-card--danger { border-color: #fca5a5; }

.admin-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
}

/* 报告权限 8 段 checkbox */
.admin-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 12px;
  padding: 8px 10px;
  background: var(--color-bg-muted);
  border-radius: 6px;
}
.admin-preset-form { margin: 0; }
.admin-preset-btn {
  font-size: 12px;
  padding: 4px 10px;
}
.admin-sections-form { margin: 0; }
.admin-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 4px;
  margin-bottom: 12px;
}
.admin-section-row {
  display: grid;
  grid-template-columns: 20px 1fr 80px 50px 16px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s;
}
.admin-section-row:hover { background: var(--color-bg-muted); }
.admin-section-row input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: #0969da;
  cursor: pointer;
}
.admin-section-label { font-weight: 500; }
.admin-section-key {
  font-size: 11px;
  padding: 1px 6px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  color: var(--color-text-muted);
  text-align: center;
}
.admin-section-origin { font-size: 11px; text-align: center; }
.admin-section-effective { text-align: center; font-size: 12px; }
.admin-section-effective--allow { color: #16a34a; }
.admin-section-effective--deny { color: var(--color-text-muted); }
.admin-form-actions { display: flex; align-items: center; padding-top: 8px; border-top: 1px solid var(--color-border); }

.admin-link-list { list-style: none; padding: 0; margin: 0 0 12px; }
.admin-link-list li {
  padding: 4px 0;
  font-size: 13px;
}
.admin-link-list li code {
  font-size: 11px;
  padding: 1px 5px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  margin-left: 6px;
}

.admin-btn--danger {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
}
.admin-btn--danger:hover { background: #b91c1c; }

/* ============================================================
   中国期货席位持仓（/fund/seat 席位视角，futures_seat SP-4）
   复用 fund-* token；红=多/增、绿=空/减沿用 .rank-positive/.rank-negative。
   ============================================================ */

/* —— 席位标签头（画像页）—— */
.seat-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seat-tag {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 12px; line-height: 1.6;
}
.seat-tag-primary { background: var(--fund-accent, #5470c6); color: #fff; font-weight: 600; }
.seat-tag-secondary { border: 1px solid var(--color-border); color: var(--color-text-muted); }
.seat-tag-pending { background: #e8a838; color: #fff; font-weight: 600; }
.seat-tag-confidence, .seat-tag-note, .seat-source {
  font-size: 11px; color: var(--color-text-muted);
}
.seat-source { display: block; margin-top: 6px; }

.seat-disclaimer {
  margin-top: 10px; padding: 10px 12px; border-radius: 6px;
  background: var(--color-bg-muted); border-left: 3px solid #e8a838;
  font-size: 12px; line-height: 1.7; color: var(--color-text-muted);
}

.seat-table-note { margin-top: 8px; font-size: 11px; line-height: 1.5; color: var(--color-text-muted); }

.seat-rank-change-note {
  margin-top: 12px; padding: 8px 12px; border-radius: 6px;
  background: var(--color-bg-muted); font-size: 12px; line-height: 1.7; color: var(--color-text-muted);
}
.seat-rank-chip {
  display: inline-block; margin: 2px 3px; padding: 1px 8px;
  border: 1px solid var(--color-border); border-radius: 10px; font-size: 11px;
}

/* —— 首屏诚实标注（首页）—— */
.seat-honest-banner {
  padding: 12px 16px; border-radius: 8px;
  background: var(--color-bg-muted); border: 1px solid var(--color-border);
  border-left: 4px solid #e8a838;
}
.seat-honest-title { font-weight: 600; font-size: 13px; color: var(--color-text); margin-bottom: 6px; }
.seat-honest-list { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.7; color: var(--color-text-muted); }
.seat-honest-list li { margin: 2px 0; }

/* —— 资金阵营仪表盘 —— */
.seat-camp-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; }
.seat-camp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* —— 今日异动 movers —— */
.seat-movers-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.seat-rank-banner {
  margin-bottom: 10px; padding: 8px 12px; border-radius: 6px;
  background: var(--color-bg-muted); font-size: 12px; line-height: 1.6; color: var(--color-text-muted);
}

/* —— 四象图工具条 —— */
.seat-quadrant-toolbar { display: flex; align-items: center; gap: 8px; }

/* —— 品种页 持仓×价格联动卡 —— */
.seat-linkage {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 10px; padding: 8px 12px; border-radius: 6px;
  background: var(--color-bg-muted); font-size: 12px;
}
.seat-linkage-title { font-weight: 600; color: var(--color-text); }
.seat-linkage-badge { padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; color: #fff; }
.seat-linkage-agree { background: #5470c6; }
.seat-linkage-diverge { background: #e8a838; }
.seat-linkage-neutral { background: #94a3b8; }
.seat-linkage-text { color: var(--color-text-muted); flex: 1 1 auto; }
.seat-linkage-note { width: 100%; font-size: 11px; color: var(--color-text-muted); }

/* —— 席位排名列表（首页脊柱入口，RP-1）—— */
.seat-rank-strength { font-variant-numeric: tabular-nums; font-weight: 600; }

/* —— 品种入口导航（点→品种持仓席位榜，RP-1）—— */
.seat-variety-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.seat-variety-chip {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 5px 12px; border-radius: 14px; border: 1px solid var(--color-border);
  font-size: 13px; color: var(--color-text); text-decoration: none; background: var(--color-bg-muted);
}
.seat-variety-chip:hover { border-color: var(--fund-accent, #5470c6); color: var(--fund-accent, #5470c6); }
.seat-variety-chip .seat-variety-code { color: var(--color-text-muted); font-size: 11px; }

/* —— 折叠支撑卡区（四象图 / 资金阵营降级，非首屏主体，RP-1）—— */
.seat-support > summary {
  cursor: pointer; padding: 10px 14px; border-radius: 8px;
  background: var(--color-bg-muted); border: 1px solid var(--color-border);
  font-weight: 600; font-size: 14px; color: var(--color-text); list-style: none;
}
.seat-support > summary::-webkit-details-marker { display: none; }
.seat-support > summary::before { content: '▸ '; color: var(--color-text-muted); }
.seat-support[open] > summary::before { content: '▾ '; }
.seat-support-sub { font-weight: 400; font-size: 12px; color: var(--color-text-muted); margin-left: 6px; }

@media (max-width: 768px) {
  .seat-camp-wrap { grid-template-columns: 1fr; }
  .seat-movers-cols { grid-template-columns: 1fr; }
}

/* —— 金银铜徽章（RP-3，inline；服务端渲染 best_badge_tier 已防抖不闪，§12.4）—— */
.seat-badge {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: middle;
  margin-left: 4px; padding: 0 6px; height: 17px; border-radius: 9px;
  font-size: 11px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--color-border); background: var(--color-bg-muted); color: var(--color-text-muted);
}
a.seat-badge { cursor: pointer; }
a.seat-badge:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.seat-badge-medal { font-size: 11px; }
.seat-badge-gold   { background: rgba(202, 138, 4, 0.12);   color: #92610a; border-color: rgba(202, 138, 4, 0.30); }
.seat-badge-silver { background: rgba(148, 163, 184, 0.18); color: #6b7280; border-color: rgba(148, 163, 184, 0.38); }
.seat-badge-bronze { background: rgba(168, 124, 76, 0.16);  color: #9a6c44; border-color: rgba(168, 124, 76, 0.32); }
[data-theme="dark"] .seat-badge        { background: var(--color-bg-muted); color: var(--color-text-muted); }
[data-theme="dark"] .seat-badge-gold   { background: rgba(234, 179, 8, 0.16);  color: #e7c66b; border-color: rgba(234, 179, 8, 0.32); }
[data-theme="dark"] .seat-badge-silver { background: rgba(203, 213, 225, 0.16); color: #e2e8f0; border-color: rgba(203, 213, 225, 0.34); }
[data-theme="dark"] .seat-badge-bronze { background: rgba(180, 120, 70, 0.16);  color: #cda57c; border-color: rgba(180, 120, 70, 0.32); }
.seat-variety-item { display: inline-flex; align-items: center; }

/* —— 多维 board 入口（RP-3，board_ready=1 才出，无死链）—— */
.seat-board-entries { display: flex; flex-wrap: wrap; gap: 8px; }
.seat-board-entry {
  display: inline-flex; flex-direction: column; gap: 2px;
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-bg-muted); color: var(--color-text); text-decoration: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.seat-board-entry:hover { border-color: var(--fund-accent, #5470c6); color: var(--fund-accent, #5470c6); }
.seat-board-entry-note { font-weight: 400; font-size: 11px; color: var(--color-text-muted); }

/* —— board 窗（modal；inline 徽章 / 入口点开，仿 f13f-modal）—— */
.seat-board-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.55); align-items: center; justify-content: center; padding: 16px;
}
.seat-board-overlay.open { display: flex; }
.seat-board-modal {
  background: var(--fund-card-bg, var(--color-bg)); border: 1px solid var(--fund-card-border, var(--color-border));
  border-radius: 10px; width: 100%; max-width: 520px; max-height: 82vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.seat-board-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--color-border);
}
.seat-board-modal-title { font-size: 15px; font-weight: 600; color: var(--color-text); }
.seat-board-modal-sub { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.seat-board-modal-close {
  background: none; border: none; color: var(--color-text-muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.seat-board-modal-close:hover { color: var(--color-text); }
.seat-board-modal-body { overflow-y: auto; padding: 8px 16px 16px; }
.seat-board-modal-loading { text-align: center; color: var(--color-text-muted); padding: 24px 0; font-size: 13px; }
