:root {
  --sb-ink: #0d2d4a;
  --sb-line: #e4ddd1;
  --sb-paper: #fffdf9;
  --sb-accent: #7357d9;
}

.sb-scroll-hint { display: none; margin: 8px 0 10px; color: #665f71; font-size: 13px; line-height: 1.45; }
.sb-formula-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #f7f3ec; color: #5f5a55; font-size: 13px; line-height: 1.55; }
.sb-matrix-scroll { max-width: 100%; overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; scrollbar-color: #b9addf #f0edf6; }
.sb-matrix-scroll .overlap-matrix { width: max-content; min-width: 100%; }

.sb-compare-dock { position: fixed; z-index: 9999; right: 18px; bottom: 18px; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 32px)); padding: 10px 12px 10px 15px; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; background: #102f4a; color: #fff; box-shadow: 0 16px 40px rgba(13,45,74,.28); transform: translateY(130%); opacity: 0; pointer-events: none; transition: transform .22s ease, opacity .22s ease; }
.sb-compare-dock.is-visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
.sb-compare-dock span { min-width: 0; font-size: 13px; line-height: 1.4; }
.sb-compare-dock button { flex: 0 0 auto; min-height: 42px; padding: 8px 12px; border: 0; border-radius: 10px; background: #fff; color: #102f4a; font: inherit; font-weight: 800; cursor: pointer; }

.sb-sector-detail { margin-top: 14px; padding: 14px; border: 1px solid #dcd3f5; border-radius: 12px; background: #faf8ff; }
.sb-sector-detail[hidden] { display: none; }
.sb-sector-detail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sb-sector-detail-head strong { color: var(--sb-ink); font-size: 16px; }
.sb-sector-detail-head span { color: #6d6680; font-size: 12px; }
.sb-sector-detail-list { display: grid; gap: 7px; max-height: 310px; overflow: auto; padding-right: 3px; }
.sb-sector-holding { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid #ebe6f8; border-radius: 9px; background: #fff; color: #273d52; font-size: 13px; }
.sb-sector-holding b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-sector-holding span:last-child { min-width: 48px; text-align: right; color: #7357d9; font-weight: 800; }

.exposure-layout { grid-template-columns: minmax(0,1fr) minmax(270px,320px) !important; align-items: start !important; gap: 18px !important; }
.exposure-layout > * { min-width: 0 !important; }
.exposure-layout .comparison-block { overflow: hidden; }
.exposure-layout .table-scroll { max-width: 100%; overflow-x: auto; }
.exposure-layout .method-card { position: sticky; top: 18px; width: auto !important; max-width: none !important; }
.result-etf-card u { text-decoration: none; }

@media (max-width: 1180px) {
  .exposure-layout { grid-template-columns: minmax(0,1fr) !important; }
  .exposure-layout .method-card { position: static; }
}

@media (max-width: 640px) {
  .comparison-block { border-radius: 14px; }
  .comparison-block:has(.metric-table) { padding: 16px 12px; }
  .comparison-block:has(.metric-table) > h3 { margin-bottom: 2px; }
  .sb-scroll-hint { display: block; }
  .metric-table { min-width: 100%; table-layout: auto; }
  .metric-table th, .metric-table td { min-width: 116px; padding: 10px 9px !important; font-size: 13px !important; line-height: 1.45; vertical-align: top; }
  .metric-table th:first-child, .metric-table td:first-child { position: sticky; left: 0; z-index: 2; min-width: 88px; width: 88px; background: var(--sb-paper); box-shadow: 1px 0 0 var(--sb-line); white-space: normal; }
  .metric-table thead th:first-child { z-index: 3; }
  .metric-table small { margin-top: 3px; font-size: 11px !important; line-height: 1.35; }
  .overlap-matrix { gap: 5px !important; }
  .overlap-matrix > * { min-height: 58px; padding: 8px 6px !important; font-size: 13px !important; }
  .result-etf-card { grid-template-columns: 34px minmax(0,1fr) auto !important; min-height: 86px; padding: 12px !important; }
  .result-etf-card span small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .result-etf-card u { grid-column: 2 / 4; margin-top: 2px; text-align: left; font-size: 12px; font-weight: 800; }
  .portfolio-audit-grid { grid-template-columns: 1fr !important; }
  .sector-bars button { min-height: 44px; }
  .sb-sector-holding { grid-template-columns: minmax(0,1fr) auto; }
  .sb-sector-holding span:nth-child(2) { display: none; }
  .sb-compare-dock { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}
