:root {
  color-scheme: light;
  --bg: #f5f4f0;
  --panel: #fffefa;
  --surface: #faf8f3;
  --text: #171a1f;
  --muted: #68707d;
  --subtle: #8a8378;
  --line: #ded9cf;
  --line-soft: #ebe7df;
  --accent: #2f6159;
  --accent-strong: #204a45;
  --accent-soft: #e7f0ec;
  --gold: #9b6b2f;
  --green: #067647;
  --red: #b42318;
  --shadow: 0 18px 42px rgba(28, 30, 33, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  backdrop-filter: blur(8px);
  background: rgba(255, 254, 250, 0.85);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
  display: flex;
  height: 60px;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 15px;
  font-weight: 760;
  gap: 10px;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand:hover {
  color: var(--accent-strong, #2f8d6c);
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(32, 74, 69, 0.18), inset 0 0 0 1px rgba(255, 254, 250, 0.18);
  color: var(--panel);
  display: inline-flex;
  font-size: 10px;
  font-weight: 780;
  height: 24px;
  justify-content: center;
  line-height: 1;
  position: relative;
  width: 28px;
}

.brand-mark::after {
  background: rgba(255, 254, 250, 0.82);
  border-radius: 999px;
  content: "";
  height: 2px;
  left: 50%;
  position: absolute;
  top: 6px;
  transform: translate(-50%, -50%);
  width: 16px;
}

.brand-mark::before {
  content: "13F";
  left: 50%;
  position: absolute;
  top: 15px;
  transform: translate(-50%, -50%);
}

.topbar-nav {
  align-items: center;
  display: flex;
  gap: 6px;
}

.topbar-link {
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 7px 14px;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.topbar-link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.topbar-link.active {
  background: rgba(47, 141, 108, 0.12);
  color: var(--accent-strong, #2f8d6c);
}

main {
  margin: 0 auto;
  max-width: 1280px;
  padding: 30px 28px 42px;
  width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.12;
  margin-bottom: 10px;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  margin-bottom: 8px;
}

h3 {
  font-size: 12px;
  margin: 0 0 9px;
  text-transform: uppercase;
}

p {
  color: var(--muted);
  margin-bottom: 0;
}

.eyebrow {
  color: var(--gold);
  display: inline-block;
  font-size: 11px;
  font-weight: 760;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.page-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.dashboard-hero {
  margin-bottom: 22px;
}

.fund-hero-stats span,
.quarter-stat span,
.table-toolbar > span {
  color: var(--subtle);
  display: block;
  font-size: 11px;
  font-weight: 730;
  text-transform: uppercase;
}

.tab-count {
  background: rgba(0, 0, 0, 0.07);
  border-radius: 999px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  padding: 2px 8px;
  vertical-align: middle;
}

.view-tab.active .tab-count {
  background: rgba(255, 254, 250, 0.22);
  color: #fffefa;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  max-width: 100%;
  overflow: auto;
  padding: 18px;
}

.panel.narrow {
  max-width: 720px;
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.7fr);
}

.selected-funds {
  padding: 0;
}

.category-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 18px;
}

.category-head p {
  max-width: 760px;
}

.category-head > span {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 730;
  padding: 3px 9px;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  background: #fbfaf6;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fbfaf6;
}

.fund-link {
  color: var(--text);
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.005em;
}

.fund-link:hover {
  color: var(--accent-strong, #2f8d6c);
}

.row-subtitle {
  color: var(--subtle);
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-top: 5px;
  max-width: 340px;
  text-transform: lowercase;
  white-space: normal;
}

.funds-table tbody td {
  padding: 16px 14px;
  vertical-align: middle;
}

.funds-table tbody tr {
  transition: background 0.12s ease;
}

.funds-table tbody tr:hover {
  background: rgba(47, 141, 108, 0.04);
}

.funds-table tbody td.number {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.profile-dot,
.period-pill {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 720;
  padding: 2px 8px;
}

.profile-dot.ready,
.period-pill {
  background: var(--accent-soft);
  border-color: #c9ddd7;
  color: var(--accent-strong);
}

.research-table {
  min-width: 1120px;
}

.research-table th:first-child,
.research-table td:first-child {
  width: 48px;
}

.research-table th:nth-child(2),
.research-table td:nth-child(2) {
  background: var(--panel);
  left: 0;
  position: sticky;
  z-index: 1;
}

.research-table th:nth-child(2) {
  z-index: 2;
}

.issuer-cell {
  font-weight: 760;
  max-width: 260px;
  min-width: 220px;
  white-space: normal;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.number {
  text-align: right;
}

.muted {
  color: var(--muted);
}

.status,
.status-pill {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  display: inline-block;
  font-size: 12px;
  font-weight: 720;
  padding: 2px 8px;
}

.status-pill {
  text-transform: capitalize;
}

.status-pill.new,
.status-pill.increased {
  background: #edf8f1;
  border-color: #bde8cd;
  color: var(--green);
}

.status-pill.reduced,
.status-pill.exited {
  background: #fff1f0;
  border-color: #f7c6c1;
  color: var(--red);
}

.delta.positive {
  color: var(--green);
}

.delta.negative {
  color: var(--red);
}

.button,
button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 730;
  min-height: 34px;
  padding: 7px 12px;
}

.button.primary,
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button:disabled {
  color: #98a2b3;
  cursor: not-allowed;
  opacity: 0.65;
}

form {
  display: grid;
  gap: 14px;
}

.inline-form {
  align-items: center;
  display: flex;
  gap: 8px;
}

label {
  color: var(--subtle);
  display: grid;
  font-size: 11px;
  font-weight: 760;
  gap: 6px;
  text-transform: uppercase;
}

input,
select,
textarea {
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
  text-transform: none;
  width: 100%;
}

.inline-form input {
  width: 72px;
}

.back-link {
  color: var(--muted);
  display: inline-block;
  font-size: 13px;
  font-weight: 730;
  margin-bottom: 14px;
}

.fund-hero {
  margin: 2px 0 20px;
}

.fund-title-row {
  align-items: end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
}

.fund-title-row h1 {
  margin-bottom: 8px;
}

.fund-title-row p {
  max-width: 720px;
}

.fund-hero-stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  min-width: 420px;
}

.fund-hero-stats div,
.quarter-stat {
  background: rgba(255, 254, 250, 0.68);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px 14px 12px;
  text-align: center;
}

.fund-hero-stats div span,
.quarter-stat span {
  letter-spacing: 0.08em;
}

.fund-hero-stats strong,
.quarter-stat strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin-top: 6px;
  overflow-wrap: normal;
  white-space: nowrap;
}

.fund-profile-panel {
  overflow: visible;
}

.profile-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  list-style: none;
  margin: -2px 0 18px;
  padding-bottom: 14px;
}

.profile-head::-webkit-details-marker {
  display: none;
}

.profile-head::after {
  align-self: center;
  color: var(--subtle);
  content: "▾";
  font-size: 14px;
  transition: transform 0.15s ease;
}

details.panel:not([open]) > summary.profile-head {
  border-bottom: none;
  margin-bottom: -2px;
  padding-bottom: 0;
}

details.panel:not([open]) > summary.profile-head::after {
  transform: rotate(-90deg);
}

.profile-action {
  align-items: flex-end;
  display: flex;
  gap: 8px;
}

.profile-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.9fr) minmax(0, 1fr);
}

.profile-grid p {
  margin-bottom: 0;
}

.people-list,
.profile-sources ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.people-list {
  display: grid;
  gap: 12px;
}

.people-list strong,
.people-list span {
  display: block;
}

.people-list span {
  color: var(--muted);
  font-size: 12px;
}

.people-list p {
  margin: 4px 0 0;
}

.profile-placeholder {
  margin-bottom: 0;
}

.profile-sources {
  margin-top: 18px;
}

.quarter-panel {
  overflow: visible;
}

.quarter-summary {
  align-items: flex-start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.quarter-stat {
  min-width: 180px;
}

.quarter-selector {
  display: grid;
  gap: 8px;
}

.quarter-controls {
  display: grid;
  gap: 10px;
}

.quarter-select {
  max-width: 660px;
}

.quarter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quarter-chip,
.limit-chip {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 730;
  justify-content: center;
  min-height: 30px;
  padding: 5px 9px;
}

.quarter-chip:hover,
.limit-chip:hover {
  border-color: var(--line);
  text-decoration: none;
}

.quarter-chip.active,
.limit-chip.active {
  background: var(--accent-soft);
  border-color: #b8d3cc;
  color: var(--accent-strong);
}

.table-toolbar {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.table-caveat {
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.45;
  margin: -4px 0 14px;
  max-width: 720px;
}

.limit-tabs {
  align-items: center;
  display: flex;
  gap: 6px;
}

.status-filter {
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: -2px 0 14px;
  padding-bottom: 0;
}

.status-chip {
  border-bottom: 2px solid transparent;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 10px 16px;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.status-chip:hover {
  color: var(--ink);
}

.status-chip.active {
  border-bottom-color: var(--accent, #2f8d6c);
  color: var(--ink);
}

/* Detail-page tab strip — prominent segmented buttons */
.view-tabs {
  background: rgba(255, 254, 250, 0.95);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 4px;
  margin: 22px 0 18px;
  padding: 5px;
}

.view-tab {
  background: transparent;
  border-radius: 8px;
  color: var(--subtle);
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 14px 22px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.view-tab:hover {
  background: rgba(47, 141, 108, 0.07);
  color: var(--ink);
}

.view-tab.active {
  background: var(--accent-strong, #2f8d6c);
  box-shadow: 0 2px 8px -2px rgba(47, 141, 108, 0.4);
  color: #fffefa;
}

.view-tab.active:hover {
  background: var(--accent-strong, #2f8d6c);
  color: #fffefa;
}

/* Summary panel: donut + top-10 list */
.summary-panel {
  overflow: visible;
  padding: 22px 22px 18px;
}

.summary-grid {
  align-items: start;
  display: grid;
  gap: 32px;
  grid-template-columns: 280px minmax(0, 1fr);
}

@media (max-width: 760px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

.donut-wrap {
  align-items: center;
  display: flex;
  height: 280px;
  justify-content: center;
  margin: 0 auto;
  position: relative;
  width: 280px;
}

.donut-svg {
  display: block;
  height: 280px;
  width: 280px;
}

.donut-slice {
  cursor: pointer;
  transition: opacity 0.15s ease;
  transform-origin: 100px 100px;
}

.donut-slice.dim {
  opacity: 0.28;
}

.donut-tooltip {
  background: rgba(28, 28, 26, 0.94);
  border-radius: 6px;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45);
  color: #fffefa;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 2px;
  left: 0;
  line-height: 1.3;
  padding: 8px 11px;
  pointer-events: none;
  position: absolute;
  top: 0;
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
  z-index: 3;
}

.donut-tooltip strong {
  color: #c5e6d8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.donut-tooltip span {
  font-size: 13px;
  font-weight: 600;
}

.donut-tooltip small {
  color: rgba(255, 254, 250, 0.65);
  font-size: 11px;
}

.donut-center {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  inset: 0;
  justify-content: center;
  pointer-events: none;
  position: absolute;
  text-align: center;
}

.donut-center span {
  color: var(--subtle);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.donut-center strong {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.donut-center small {
  color: var(--subtle);
  font-size: 11px;
  margin-top: 4px;
}

/* Top-10 list */
.top-list {
  display: flex;
  flex-direction: column;
}

.top-list-head,
.top-list-row {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.6fr) 92px 64px 92px 32px;
  padding: 8px 14px 8px 10px;
}

.top-list-head {
  border-bottom: 1px solid var(--line-soft);
  color: var(--subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.top-list-row {
  border-radius: 6px;
  color: inherit;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.12s ease;
}

.top-list-row:hover,
.top-list-row.active {
  background: rgba(47, 141, 108, 0.08);
}

.top-list-row.others {
  color: var(--subtle);
  font-style: italic;
}

.cell-issuer {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.cell-issuer .swatch {
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
  height: 10px;
  width: 10px;
}

.cell-issuer .issuer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-issuer .ticker {
  background: rgba(47, 141, 108, 0.12);
  border-radius: 3px;
  color: var(--accent-strong, #2f8d6c);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  text-transform: uppercase;
}

.cell-value,
.cell-weight,
.cell-delta {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.cell-delta.positive { color: var(--positive, #1c8a5b); }
.cell-delta.negative { color: var(--negative, #b54545); }

.cell-status {
  display: flex;
  justify-content: center;
}

.issuer-cell .ticker {
  background: rgba(47, 141, 108, 0.12);
  border-radius: 3px;
  color: var(--accent-strong, #2f8d6c);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 6px;
  padding: 2px 5px;
  text-transform: uppercase;
}

[data-swap-zone] {
  transition: opacity 0.12s ease;
}

[data-swap-zone].swap-loading {
  opacity: 0.55;
}

/* Inline status icon */
.status-icon {
  display: inline-flex;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
  vertical-align: middle;
}

.status-icon svg {
  display: block;
}

/* Insights tab */
.insights-panel {
  padding: 22px 26px 24px;
}

.insights-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.insights-header h2 {
  font-size: 15px;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.insights-header p {
  color: var(--subtle);
  font-size: 12px;
  margin: 0;
}

.insights-summary {
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 18px;
}

.insights-bullets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.insight-bullet {
  align-items: flex-start;
  background: rgba(255, 254, 250, 0.65);
  border: 1px solid var(--line-soft);
  border-left: 4px solid #bfbab0;
  border-radius: 6px;
  display: grid;
  gap: 14px;
  grid-template-columns: 110px minmax(0, 1fr);
  padding: 12px 14px;
}

.insight-bullet strong {
  display: block;
  font-size: 14px;
}

.insight-bullet p {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  margin: 4px 0 0;
}

.insight-bullet .ticker {
  background: rgba(47, 141, 108, 0.12);
  border-radius: 3px;
  color: var(--accent-strong, #2f8d6c);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 6px;
  padding: 2px 5px;
  text-transform: uppercase;
}

.insight-badge {
  border-radius: 4px;
  color: #fffefa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 8px;
  text-align: center;
  white-space: nowrap;
}

.insight-bullet.bullet-new        { border-left-color: #1c8a5b; }
.insight-bullet.bullet-add        { border-left-color: #2f8d6c; }
.insight-bullet.bullet-exit       { border-left-color: #b54545; }
.insight-bullet.bullet-reduce     { border-left-color: #c98044; }
.insight-bullet.bullet-persistence { border-left-color: #d4a017; }
.insight-bullet.bullet-concentration { border-left-color: #5b6c8a; }
.insight-bullet.bullet-context    { border-left-color: #9b9684; }

.insight-badge.bullet-new        { background: #1c8a5b; }
.insight-badge.bullet-add        { background: #2f8d6c; }
.insight-badge.bullet-exit       { background: #b54545; }
.insight-badge.bullet-reduce     { background: #c98044; }
.insight-badge.bullet-persistence { background: #d4a017; }
.insight-badge.bullet-concentration { background: #5b6c8a; }
.insight-badge.bullet-context    { background: #9b9684; }

.insights-status {
  font-size: 14px;
  margin: 20px 0;
}

.insights-status.muted { color: var(--subtle); }
.insights-status.error { color: var(--negative, #b54545); }

.insights-meta {
  color: var(--subtle);
  font-size: 11px;
  margin: 18px 0 0;
}

.insights-meta code {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  font-size: 11px;
  padding: 1px 5px;
}

.insights-raw {
  margin-top: 14px;
}

.insights-raw summary {
  color: var(--subtle);
  cursor: pointer;
  font-size: 12px;
}

.insights-raw pre {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  font-size: 11px;
  margin-top: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
}

.value-trend-panel {
  overflow: visible;
  padding: 18px 20px 22px;
}

.value-trend-head {
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.value-trend-head h2 {
  font-size: 13px;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.value-trend-head p {
  color: var(--subtle);
  font-size: 12px;
  margin: 0;
}

.value-trend-head strong {
  color: var(--ink);
}

.trend-chart-wrap {
  overflow: visible;
  position: relative;
}

.trend-chart-wrap svg {
  display: block;
  height: auto;
  max-width: 100%;
  width: 100%;
}

.trend-chart-wrap .trend-dot {
  transition: r 0.12s ease;
}

.trend-chart-wrap .trend-hit {
  cursor: pointer;
}

.trend-tooltip {
  background: rgba(28, 28, 26, 0.94);
  border-radius: 6px;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45);
  color: #fffefa;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 2px;
  left: 0;
  line-height: 1.3;
  padding: 8px 11px;
  pointer-events: none;
  position: absolute;
  top: 0;
  transform: translate(-50%, calc(-100% - 12px));
  white-space: nowrap;
  z-index: 2;
}

.trend-tooltip strong {
  color: #c5e6d8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trend-tooltip span {
  font-size: 14px;
  font-weight: 600;
}

.trend-tooltip::after {
  border: 6px solid transparent;
  border-top-color: rgba(28, 28, 26, 0.94);
  bottom: -12px;
  content: "";
  left: calc(50% - 6px);
  position: absolute;
}

.reorder-hint {
  color: var(--subtle);
  font-size: 12px;
  margin: -4px 0 10px;
}

.drag-col {
  padding-left: 0;
  padding-right: 0;
  width: 22px;
}

.drag-handle {
  color: var(--subtle);
  cursor: grab;
  display: inline-block;
  font-size: 14px;
  letter-spacing: -2px;
  user-select: none;
}

tr[data-fund-id] {
  cursor: grab;
}

.funds-table.is-readonly tr[data-fund-id] {
  cursor: default;
}

tr[data-fund-id].dragging {
  cursor: grabbing;
  opacity: 0.4;
}

tr.reorder-pending td {
  background: rgba(47, 141, 108, 0.05) !important;
}

tr.reorder-success td {
  animation: reorderFlash 0.9s ease-out;
}

tr.reorder-failed td {
  background: rgba(181, 69, 69, 0.18) !important;
}

@keyframes reorderFlash {
  0%   { background: rgba(47, 141, 108, 0.32); }
  100% { background: transparent; }
}

.empty-state {
  padding: 24px 18px;
}

.empty-state strong {
  display: block;
  margin-bottom: 4px;
}

.notice {
  background: var(--accent-soft);
  border: 1px solid #c9ddd7;
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
}

.notice.error {
  background: #fff1f0;
  border-color: #f7c6c1;
  color: var(--red);
}

.facts {
  display: grid;
  gap: 10px 20px;
  grid-template-columns: 160px minmax(0, 1fr);
  margin: 0;
}

.facts dt {
  color: var(--muted);
  font-weight: 730;
}

.facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.debug-panel {
  background: rgba(255, 254, 250, 0.74);
  box-shadow: none;
}

summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 730;
}

details[open] summary {
  color: var(--text);
  margin-bottom: 14px;
}

@media (max-width: 1120px) {
  .fund-title-row {
    align-items: end;
    display: flex;
    gap: 22px;
  }

  .fund-title-row p {
    max-width: 680px;
  }

  .fund-hero-stats {
    flex: 0 0 376px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 376px;
  }

  .fund-hero-stats div {
    padding: 12px 8px 11px;
  }

  .fund-hero-stats div span {
    font-size: 10px;
    letter-spacing: 0.055em;
  }

  .fund-hero-stats strong {
    font-size: 17px;
  }
}

@media (max-width: 980px) {
  .topbar {
    padding: 0 16px;
  }

  main {
    padding: 22px 12px 34px;
  }

  .dashboard-hero,
  .grid {
    grid-template-columns: 1fr;
  }

  .category-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fund-title-row,
  .page-head,
  .category-head,
  .profile-head,
  .table-toolbar,
  .section-head {
    display: block;
  }

  .fund-hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 14px;
    min-width: 0;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-action,
  .limit-tabs {
    margin-top: 12px;
  }

  .quarter-summary {
    display: block;
  }

  .quarter-stat {
    margin-top: 12px;
  }

  .quarter-select {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: 58px;
    padding: 0 14px;
  }

  .brand {
    font-size: 14px;
    min-width: 0;
  }

  .brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-link {
    font-size: 12px;
    padding: 7px 12px;
  }

  main {
    padding: 24px 12px 32px;
  }

  h1 {
    font-size: 27px;
  }

  h2 {
    font-size: 17px;
  }

  .dashboard-hero {
    margin-bottom: 18px;
  }

  .fund-title-row p {
    font-size: 13px;
    line-height: 1.55;
  }

  .fund-hero-stats {
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fund-hero-stats div,
  .quarter-stat {
    border-radius: 8px;
    padding: 11px 8px 10px;
  }

  .fund-hero-stats div span,
  .quarter-stat span {
    font-size: 10px;
    letter-spacing: 0.07em;
  }

  .fund-hero-stats strong,
  .quarter-stat strong {
    font-size: 17px;
    overflow-wrap: normal;
    white-space: nowrap;
  }

  .view-tabs {
    border-radius: 10px;
    gap: 3px;
    margin: 18px 0 16px;
    padding: 4px;
  }

  .view-tab {
    align-items: center;
    display: inline-flex;
    flex: 1 1 0;
    font-size: 12px;
    justify-content: center;
    letter-spacing: 0.035em;
    min-height: 52px;
    min-width: 0;
    overflow-wrap: normal;
    padding: 10px 6px;
  }

  .dashboard-tabs {
    flex-wrap: wrap;
  }

  .dashboard-tabs .view-tab {
    flex: 1 0 calc(50% - 3px);
    min-height: 44px;
  }

  .detail-tabs .view-tab {
    flex: 1 1 0;
  }

  .tab-count {
    flex: 0 0 auto;
    font-size: 10px;
    margin-left: 5px;
    padding: 1px 6px;
  }

  .panel {
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 16px;
  }

  .category-head {
    padding: 16px;
  }

  .category-head h2 {
    margin-bottom: 6px;
  }

  .category-head p {
    font-size: 13px;
    line-height: 1.45;
  }

  .category-head > span {
    display: inline-flex;
    margin-top: 10px;
  }

  .selected-funds {
    overflow: hidden;
  }

  .funds-table,
  .funds-table tbody,
  .funds-table tr,
  .funds-table td {
    display: block;
    width: 100%;
  }

  .funds-table thead {
    display: none;
  }

  .funds-table tbody tr {
    border-bottom: 1px solid var(--line-soft);
    padding: 15px 16px 14px 28px;
    position: relative;
  }

  .funds-table tbody tr:last-child {
    border-bottom: 0;
  }

  .funds-table tbody td {
    border-bottom: 0;
    padding: 0;
    text-align: left;
    white-space: normal;
  }

  .funds-table .drag-col {
    left: 9px;
    position: absolute;
    top: 18px;
    width: auto;
  }

  .funds-table td:nth-child(2) {
    margin-bottom: 12px;
  }

  .funds-table.is-readonly td:nth-child(1) {
    margin-bottom: 12px;
  }

  .fund-link {
    font-size: 15px;
    line-height: 1.25;
  }

  .row-subtitle {
    max-width: none;
  }

  .funds-table td:nth-child(n+3) {
    align-items: center;
    display: flex;
    font-size: 13px;
    gap: 14px;
    justify-content: space-between;
    padding: 5px 0;
  }

  .funds-table.is-readonly td:nth-child(n+2) {
    align-items: center;
    display: flex;
    font-size: 13px;
    gap: 14px;
    justify-content: space-between;
    padding: 5px 0;
  }

  .funds-table td:nth-child(3)::before { content: "Value"; }
  .funds-table td:nth-child(4)::before { content: "Positions"; }
  .funds-table td:nth-child(5)::before { content: "Quarters"; }
  .funds-table td:nth-child(6)::before { content: "Latest"; }

  .funds-table.is-readonly td:nth-child(2)::before { content: "Value"; }
  .funds-table.is-readonly td:nth-child(3)::before { content: "Positions"; }
  .funds-table.is-readonly td:nth-child(4)::before { content: "Quarters"; }
  .funds-table.is-readonly td:nth-child(5)::before { content: "Latest"; }

  .funds-table td:nth-child(n+3)::before {
    color: var(--subtle);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .funds-table.is-readonly td:nth-child(n+2)::before {
    color: var(--subtle);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .funds-table tbody td.number {
    text-align: right;
  }

  .funds-table.is-readonly tr[data-fund-id] {
    cursor: default;
  }

  .profile-dot,
  .period-pill {
    font-size: 11px;
    padding: 2px 7px;
  }

  .quarter-chips,
  .status-filter {
    flex-wrap: nowrap;
    margin-left: -16px;
    margin-right: -16px;
    overflow-x: auto;
    padding-left: 16px;
    padding-right: 16px;
    scrollbar-width: none;
  }

  .quarter-chips::-webkit-scrollbar,
  .status-filter::-webkit-scrollbar {
    display: none;
  }

  .quarter-chip,
  .limit-chip,
  .status-chip {
    flex: 0 0 auto;
  }

  .summary-panel {
    padding: 18px 14px 16px;
  }

  .donut-wrap,
  .donut-svg {
    height: 236px;
    width: 236px;
  }

  .top-list {
    margin-left: -2px;
    margin-right: -2px;
  }

  .top-list-head {
    display: none;
  }

  .top-list-row {
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    display: grid;
    gap: 2px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 11px 2px;
  }

  .top-list-row:last-child {
    border-bottom: 0;
  }

  .cell-issuer {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .cell-value {
    grid-column: 2;
    grid-row: 1;
  }

  .cell-weight {
    color: var(--subtle);
    font-size: 12px;
    grid-column: 2;
    grid-row: 2;
  }

  .cell-delta {
    font-size: 12px;
    grid-column: 1 / span 2;
    grid-row: 3;
    justify-self: start;
    text-align: left;
  }

  .cell-status {
    display: none;
  }

  .cell-issuer .issuer-name {
    white-space: normal;
  }

  .value-trend-panel {
    padding: 16px 14px 18px;
  }

  .trend-chart-wrap {
    margin-left: -8px;
    margin-right: -8px;
  }

  .table-toolbar {
    display: block;
  }

  .limit-tabs {
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .limit-tabs::-webkit-scrollbar {
    display: none;
  }

  .research-table {
    min-width: 0;
  }

  .research-table,
  .research-table tbody,
  .research-table tr,
  .research-table td {
    display: block;
    width: 100%;
  }

  .research-table thead {
    display: none;
  }

  .research-table tbody tr {
    border-bottom: 1px solid var(--line-soft);
    padding: 14px 0;
  }

  .research-table tbody tr:last-child {
    border-bottom: 0;
  }

  .research-table td,
  .research-table td:first-child,
  .research-table td:nth-child(2) {
    background: transparent;
    border-bottom: 0;
    left: auto;
    padding: 4px 0;
    position: static;
    white-space: normal;
  }

  .research-table td:nth-child(1) {
    color: var(--subtle);
    float: right;
    font-size: 11px;
    padding-top: 2px;
    width: auto;
  }

  .research-table .issuer-cell {
    font-size: 15px;
    margin-bottom: 8px;
    max-width: none;
    min-width: 0;
    padding-right: 42px;
  }

  .research-table td:nth-child(n+3) {
    align-items: center;
    display: flex;
    font-size: 13px;
    gap: 14px;
    justify-content: space-between;
  }

  .research-table td:nth-child(3)::before { content: "Value"; }
  .research-table td:nth-child(4)::before { content: "Weight"; }
  .research-table td:nth-child(5)::before { content: "Shares"; }
  .research-table td:nth-child(6)::before { content: "Share d"; }
  .research-table td:nth-child(7)::before { content: "Share d%"; }
  .research-table td:nth-child(8)::before { content: "Prev weight"; }
  .research-table td:nth-child(9)::before { content: "First held"; }
  .research-table td:nth-child(10)::before { content: "Price"; }
  .research-table td:nth-child(11)::before { content: "Est. cost"; }
  .research-table td:nth-child(12)::before { content: "Unrealized"; }
  .research-table td:nth-child(13)::before { content: "Status"; }

  .research-table td:nth-child(n+3)::before {
    color: var(--subtle);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .research-table .number {
    text-align: right;
  }

  .insights-panel {
    padding: 18px 16px 20px;
  }

  .insights-header {
    display: block;
  }

  .insights-header form {
    margin-top: 12px;
  }

  .insight-bullet {
    gap: 8px;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .insight-badge {
    justify-self: start;
  }

  .facts {
    grid-template-columns: 1fr;
  }

  .facts dt {
    margin-top: 8px;
  }

  .debug-panel {
    overflow-x: auto;
  }

  .debug-panel table {
    min-width: 720px;
  }
}
