:root {
  --bg: #f5f7fb;
  --panel: #fff;
  --text: #142033;
  --muted: #7a8495;
  --blue: #1976f3;
  --blue-soft: #e8f2ff;
  --line: #e6ebf2;
  --red: #e44545;
  --down: #2563eb;
  --pink: #fff2f2;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 210px; background: #101827; color: white; padding: 28px 20px; }
.brand { font-size: 22px; font-weight: 800; margin-bottom: 28px; }
.sidebar a { display: block; color: #b9c4d8; text-decoration: none; padding: 12px 0; }
main { margin-left: 210px; padding: 28px; }
.hero { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.eyebrow { color: var(--blue); font-weight: 700; margin: 0 0 6px; }
h1, h2, h3 { margin: 0; }
.date-chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 8px 22px rgba(16,24,39,.04); }
.card { padding: 18px; }
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 24px; font-weight: 800; margin-top: 8px; }
.layout { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
input { width: 180px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.filters, .tabs, .periods, .change-filters { display: flex; gap: 8px; flex-wrap: wrap; }
button { border: 0; cursor: pointer; font-family: inherit; font-weight: 700; border-radius: 999px; padding: 10px 14px; background: var(--blue-soft); color: var(--blue); -webkit-appearance: none; appearance: none; }
button.active { background: var(--blue); color: white; }
.etf-list { display: flex; flex-direction: column; gap: 8px; max-height: 690px; overflow: auto; padding-bottom: 18px; scrollbar-gutter: stable; }
.etf-item { text-align: left; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 12px; color: var(--text); }
.etf-item.active { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.etf-name { font-weight: 800; line-height: 1.35; }
.meta { color: var(--muted); font-size: 13px; margin-top: 5px; }
.badge { display: inline-flex; align-items: center; background: #eef2f7; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 800; color: #4b5563; margin-right: 6px; }
.detail-title { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.kpi { background: #f8fafc; border-radius: 14px; padding: 12px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-weight: 800; margin-top: 5px; }
.holdings-card { border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.holdings-top { padding: 16px; background: white; }
.holdings-tabs { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 14px; }
.asof { color: var(--muted); font-size: 14px; }
.change-filters { margin-bottom: 10px; }
.periods { margin-bottom: 6px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table-wrap { max-height: 620px; overflow: auto; }
thead { background: #eef7ff; color: #536172; position: sticky; top: 0; z-index: 1; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; width: 54%; }
.rank { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 800; margin-right: 10px; }
.holding-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; display: inline-block; max-width: calc(100% - 42px); }
.positive { color: var(--red); font-weight: 800; }
.negative { color: var(--down); font-weight: 800; }
.neutral { color: var(--red); font-weight: 800; }
tr.row-increase, tr.row-increase td { background: #fff1f1; }
tr.row-decrease, tr.row-decrease td { background: #f1f6ff; }
tr.row-increase.highlight, tr.row-increase.highlight td { background: #fff1f1; }
.highlight { background: var(--pink); }
.empty { color: var(--muted); padding: 40px; text-align: center; }
.small-note { color: var(--muted); font-size: 12px; margin-top: 8px; }
@media (max-width: 1000px) {
  .sidebar { display: none; }
  main { margin-left: 0; padding: 16px; }
  .cards, .layout, .kpis { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  :root {
    --bg: #f6f8fc;
    --text: #142033;
  }

  html { -webkit-text-size-adjust: 100%; }
  body {
    font-size: 14px;
    line-height: 1.35;
    overflow-x: hidden;
  }

  main {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    padding: 18px 14px 88px;
  }

  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
    margin-bottom: 14px;
  }
  .eyebrow {
    font-size: 15px;
    line-height: 1.25;
    margin-bottom: 6px;
  }
  h1 {
    font-size: 30px;
    line-height: 1.12;
    letter-spacing: -0.04em;
  }
  h2 {
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: -0.035em;
  }
  .date-chip {
    max-width: 124px;
    padding: 9px 12px;
    font-size: 15px;
    line-height: 1.25;
    text-align: center;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
  }
  .card, .panel {
    border-radius: 18px;
    box-shadow: 0 4px 14px rgba(16,24,39,.035);
  }
  .card { padding: 14px; min-height: 86px; }
  .card .label { font-size: 12px; }
  .card .value {
    font-size: 23px;
    line-height: 1.15;
    word-break: keep-all;
  }

  .layout { gap: 12px; }
  .panel { padding: 14px; }
  .list-panel { overflow: hidden; }
  .panel-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }
  input {
    width: 100%;
    min-height: 42px;
    border-radius: 14px;
    font-size: 16px;
    padding: 10px 12px;
  }
  .filters, .tabs, .periods, .change-filters { gap: 7px; }
  button {
    min-height: 38px;
    padding: 9px 13px;
    font-size: 14px;
    line-height: 1.1;
  }

  .etf-list {
    max-height: 380px;
    overflow-y: auto;
    gap: 7px;
    padding-bottom: 6px;
    scrollbar-gutter: auto;
  }
  .etf-item {
    display: block;
    width: 100%;
    min-height: auto;
    overflow: hidden;
    border-radius: 14px;
    padding: 10px 11px;
    line-height: 1.25;
  }
  .etf-item > div:first-child {
    display: flex;
    gap: 4px;
    align-items: center;
    min-width: 0;
  }
  .etf-name {
    display: block;
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.25;
    letter-spacing: -0.035em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .meta {
    display: none;
  }
  .badge {
    flex: 0 0 auto;
    font-size: 11px;
    line-height: 1;
    padding: 4px 8px;
    margin-right: 4px;
  }

  .detail-panel { padding: 14px; }
  .detail-title {
    display: block;
    margin-bottom: 12px;
  }
  .detail-title h2 {
    margin-top: 6px;
    font-size: 24px;
    line-height: 1.18;
    word-break: keep-all;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }
  .kpi {
    border-radius: 14px;
    padding: 12px;
    min-height: 74px;
  }
  .kpi .label { font-size: 12px; }
  .kpi .value {
    font-size: 17px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .holdings-card { border-radius: 18px; }
  .holdings-top { padding: 12px; }
  .holdings-tabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }
  .tabs, .periods, .change-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tabs button, .periods button, .change-filters button { width: 100%; }
  .asof {
    font-size: 13px;
    text-align: left;
  }
  .small-note {
    font-size: 12px;
    line-height: 1.35;
  }

  .table-wrap {
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
  }
  table {
    table-layout: fixed;
    font-size: 14px;
  }
  th, td {
    padding: 12px 8px;
    height: 58px;
    vertical-align: middle;
  }
  th {
    font-size: 13px;
    line-height: 1.25;
    word-break: keep-all;
  }
  th:first-child, td:first-child { width: 48%; }
  th:nth-child(2), td:nth-child(2) { width: 24%; }
  th:nth-child(3), td:nth-child(3) { width: 28%; }
  td:nth-child(2), td:nth-child(3) {
    font-size: 15px;
    white-space: nowrap;
  }
  td:nth-child(3) {
    font-size: 16px;
    letter-spacing: -0.03em;
  }
  .rank {
    width: 25px;
    height: 25px;
    margin-right: 6px;
    font-size: 14px;
    flex: 0 0 auto;
  }
  .holding-name {
    max-width: calc(100% - 34px);
    font-size: 15px;
    letter-spacing: -0.035em;
  }
  tr.row-increase { background: #fff1f1; }
  tr.row-decrease { background: #f1f6ff; }
  tr.row-increase.highlight { background: #fff1f1; }
}

@media (max-width: 380px) {
  main { padding-left: 10px; padding-right: 10px; }
  h1 { font-size: 27px; }
  h2, .detail-title h2 { font-size: 22px; }
  .card .value { font-size: 21px; }
  button { padding-left: 10px; padding-right: 10px; }
  th, td { padding-left: 6px; padding-right: 6px; }
  td:nth-child(2), td:nth-child(3) { font-size: 14px; }
  .holding-name { font-size: 14px; }
}
