/* ETF detail terminal layer — loaded after the legacy component styles.
   只覆寫 shared.css dark palette 的「綠黑」變體 + 版面 token；不新增色彩系統。 */
:root {
  --night: #050b08;
  --night-panel: #0a1410;
  --night-lift: #0f1f18;
  --night-rule: #22352b;
  --night-rule-strong: #5f7c6b;
  --signal: #b6db5a;
  --fog: #8fa299;
  --haze: #c3d0c8;
  --accent: #b6db5a;
  --accent-dn: #69c894;
  --gold: #b6db5a;
  --gold-soft: #9fc34d;
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --shadow-soft: none;
  --font-display: "Noto Serif TC", "Songti TC", Georgia, serif;
  --font-body: "PingFang TC", "Noto Sans TC", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

html {
  background: var(--night);
}

body {
  color: #fff;
  background:
    linear-gradient(rgba(101, 147, 119, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(101, 147, 119, .06) 1px, transparent 1px),
    var(--night);
  background-size: 72px 72px;
  font-family: var(--font-body);
}

.etf-mast {
  min-height: 66px;
  padding: 12px max(18px, calc((100vw - var(--content-wide)) / 2));
  border-bottom: 1px solid var(--night-rule);
  background: rgba(4, 10, 7, .96);
}

.etf-mast-code {
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 14px;
}

.etf-mast-name {
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
}

.etf-mast-back,
.etf-mast-r {
  color: var(--fog);
}

.etf-mast-r strong {
  color: var(--signal);
}

main {
  width: min(1180px, calc(100% - 40px));
  max-width: none;
  margin: 0 auto;
  padding: 28px 0 68px;
}

.tabs {
  position: sticky;
  top: 8px;
  z-index: 8;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--night-rule);
  border-radius: 0;
  background: var(--night-panel);
}

.tabs button {
  min-height: 52px;
  margin: 0;
  padding: 10px 16px;
  border: 0;
  border-right: 1px solid var(--night-rule);
  border-radius: 0;
  color: var(--fog);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.tabs button:last-child {
  border-right: 0;
}

.tabs button:hover {
  color: #fff;
  background: rgba(105, 200, 148, .055);
}

.tabs button.active {
  border-color: var(--night-rule);
  color: #07100b;
  background: var(--signal);
  box-shadow: none;
}

.tabs button .count {
  color: inherit;
  opacity: .72;
}

.panel {
  min-height: 640px;
  margin-top: 16px;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--night-rule);
  border-radius: 0;
  background: var(--night-panel);
}

.panel-title {
  margin: 0 0 22px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--night-rule);
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

table {
  color: var(--haze);
}

th {
  color: var(--fog);
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: .04em;
}

table.holdings {
  border: 1px solid var(--night-rule);
}

table.holdings thead {
  color: #fff;
  background: #0f2118;
}

table.holdings thead th {
  border-color: var(--night-rule);
  color: var(--signal);
}

table.holdings td {
  border-color: var(--night-rule);
}

table.holdings td.name,
.detail-head .title {
  color: #fff;
  font-weight: 700;
}

table.holdings td.code,
table.holdings td.since,
.detail-subtitle {
  color: var(--fog);
}

table.holdings tbody tr:hover {
  background: rgba(182, 219, 90, .06);
}

.industry-board,
.industry-chart,
.industry-legend,
.industry-detail,
.daily-card,
.daily-card-head,
.daily-card-foot,
.daily-wrap,
.daily-kpi-card,
.daily-snap-card,
.sm-cell,
.pnl-card,
.pnl-card .metric,
.pnl-rank-card,
.events,
.events .ev,
.exited-strip .e,
.issue-strip .metric,
.glossary-popover {
  border-color: var(--night-rule) !important;
  color: var(--haze);
  background: var(--night-panel) !important;
  box-shadow: none !important;
}

.industry-board,
.daily-card,
.pnl-card,
.events {
  border: 1px solid var(--night-rule);
}

.industry-chart,
.industry-legend,
.industry-detail {
  background: transparent !important;
}

.daily-card-head,
.daily-card-foot {
  background: var(--night-lift) !important;
}

.daily-row {
  border-color: var(--night-rule) !important;
}

.daily-row:hover {
  background: rgba(182, 219, 90, .055) !important;
}

.daily-kpi-card strong,
.daily-snap-card strong,
.pnl-rank-card strong,
.pnl-card .metric .v {
  color: #fff;
}

.daily-kpi-label,
.daily-snap-label,
.sm-head .c,
.sm-cell .peak,
.pnl-card .metric .k,
.pnl-card .meta-label {
  color: var(--fog);
}

.industry-chip,
.picker-col button,
.glossary-btn,
.danmaku-form input,
.danmaku-form button {
  min-height: 38px;
  border: 1px solid var(--night-rule);
  border-radius: 0;
  color: var(--haze);
  background: var(--night-panel);
}

.picker-col button:hover,
.industry-chip:hover,
.glossary-btn:hover {
  border-color: var(--night-rule-strong);
  color: var(--signal);
}

.picker-col button.active {
  border-color: var(--signal);
  color: #07100b;
  background: var(--signal);
}

.detail-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--night-rule);
}

.detail-head .title {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 34px);
}

.weight-now {
  color: var(--signal);
  font-family: var(--font-mono);
}

.chart-legend {
  color: var(--fog);
  font-family: var(--font-mono);
}

#detail-chart {
  overflow: hidden;
  border: 1px solid var(--night-rule);
  background: var(--night);
}

.timeline-panel svg,
#detail-pnl-chart {
  background: transparent;
}

.ev-type,
.ev-pnl-badge {
  border: 1px solid currentColor;
  border-radius: 0;
}

.up,
.positive,
.gain {
  color: var(--up) !important;
}

.down,
.negative,
.loss {
  color: var(--down) !important;
}

.panel-empty,
.empty-state {
  color: var(--fog);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--night);
}

::-webkit-scrollbar-thumb {
  border: 2px solid var(--night);
  border-radius: 0;
  background: var(--night-rule-strong);
}

.public-disclosure-footer {
  width: 100%;
  margin-top: 0;
  border-top: 1px solid var(--night-rule);
  color: var(--fog);
  background: rgba(4, 10, 7, .98);
}

.public-disclosure-footer__brand {
  color: var(--signal);
}

.public-disclosure-footer__links a:hover {
  color: #fff;
}

.footer {
  display: none !important;
}

@media (max-width: 760px) {
  main {
    width: min(100% - 24px, 680px);
    padding-top: 14px;
  }

  .tabs {
    top: 0;
    overflow-x: auto;
  }

  .tabs button {
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  body {
    background-size: 44px 44px;
  }

  .etf-mast {
    min-height: 0;
    padding: 9px 12px;
  }

  .etf-mast-r {
    max-height: 42px;
    overflow: hidden;
  }

  main {
    width: 100%;
    padding: 0 0 28px;
  }

  .tabs {
    margin: 0;
    padding: 0 8px;
    border-top: 0;
    border-right: 0;
    border-left: 0;
    background: rgba(5, 11, 8, .97);
    box-shadow: none;
  }

  .tabs button {
    min-height: 46px;
    padding: 9px 12px;
    border-right: 0;
    border-bottom: 3px solid transparent;
    color: var(--fog);
    background: transparent;
    font-size: 10px;
  }

  .tabs button.active {
    border-bottom-color: var(--signal);
    color: var(--signal);
    background: transparent;
  }

  .panel {
    min-height: 0;
    margin-top: 0;
    padding: 22px 12px 28px;
    border: 0;
    border-bottom: 1px solid var(--night-rule);
    background: rgba(5, 11, 8, .92);
    box-shadow: none;
  }

  .panel-title {
    margin-bottom: 16px;
    line-height: 1.65;
  }

  .detail-layout {
    gap: 10px;
  }

  .picker-col {
    margin: 0 -4px;
    padding: 0 4px 8px;
    scroll-padding-inline: 4px;
  }

  .picker-col button {
    min-height: 36px;
    padding: 7px 9px;
  }

  .detail-head {
    align-items: center;
    gap: 8px;
  }

  .detail-head .title {
    min-width: 0;
    font-size: 22px;
  }

  .industry-chip {
    max-width: 132px;
    min-height: 34px;
    padding: 5px 8px;
  }

  .detail-subtitle {
    margin-bottom: 10px;
    line-height: 1.55;
  }

  .issue-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .issue-strip .metric {
    padding: 9px 10px;
  }

  .issue-strip .metric:nth-child(3) {
    grid-column: 1 / -1;
  }

  .pnl-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 7px;
  }

  .pnl-card .metric {
    padding: 10px;
  }

  .pnl-card .metric.main {
    min-height: 72px;
    padding: 10px;
  }

  .pnl-card .metric.main:nth-child(3) {
    grid-column: 1 / -1;
  }

  .pnl-card .metric.main .v {
    font-size: 18px;
  }

  .pnl-card .meta-row {
    flex-direction: row;
    gap: 4px 10px;
  }

  .pnl-card .meta-item {
    white-space: normal;
  }

  .pnl-card .meta-item::after {
    margin: 0;
    content: "";
  }

  #detail-chart {
    height: 310px;
  }

  .public-disclosure-footer__inner {
    padding: 18px 14px 24px;
  }
}
