/* ==========================================================================
   Long Equity: Institutional 13F Fund Overlap Explorer
   Styled consistently with Long Equity Portfolio Builder
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface2: #F8FAFC;
  --border: #E2E8F0;
  --border-subtle: #F1F5F9;
  --text: #0F172A;
  --text2: #475569;
  --text3: #94A3B8;
  --accent: #0284C7;
  --accent-light: #E0F2FE;
  --green: #10B981;
  --green-bg: #ECFDF5;
  --amber: #B45309;
  --amber-bg: #FEF3C7;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.05);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Top Hero Header Bar (Matches Portfolio Builder) */
.top-header {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background-color: #ffffff;
  border: 1px solid #E5E7EB;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.hero-pill-dot {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background-color: #10B981;
  box-shadow: 0 0 0 4px #D1FAE5;
  animation: pillPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  flex-shrink: 0;
}

@keyframes pillPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero-pill-text {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #262626;
  text-transform: uppercase;
  line-height: 1;
}

.page-title {
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: clamp(32px, 3.8vw, 54px);
  font-weight: 400;
  letter-spacing: -0.03em;
  color: #18181B;
  line-height: 1.14;
  margin: 0;
  text-align: center;
}

.page-title-bold {
  font-weight: 600;
  color: #171717;
}

.page-subtitle {
  margin: 0;
  max-width: 680px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text2);
  text-align: center;
}

.portfolio-save-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 5px 14px;
  line-height: 1.4;
  text-align: center;
  max-width: 720px;
}

.portfolio-save-tip svg {
  color: var(--accent);
  flex-shrink: 0;
}

.portfolio-save-tip strong {
  color: var(--text);
  font-weight: 600;
}

/* Workspace Container */
.fo-workspace {
  max-width: 1480px;
  margin: 0 auto;
  padding: 12px 20px 24px;
}

/* KPI Grid & Cards (Matches Portfolio Builder) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 780px) {
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}

.kpi-card:hover {
  border-color: #CBD5E1;
}

.kpi-label {
  font-size: 9.5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  margin-bottom: 5px;
}

.kpi-value {
  font-size: 21px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hint {
  font-size: 11.5px;
  color: var(--text3);
  font-weight: 500;
}

/* Pill-tray Tabs (Matches Portfolio Builder) */
.fo-tabs-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.tabs-row {
  display: inline-flex;
  gap: 4px;
  background: #EDE9E3;
  border-radius: 10px;
  padding: 4px;
  border: 1px solid #DDD7CC;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 8px 18px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  color: #57534E;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab-btn:hover:not(.active) {
  color: #1C1917;
}

.tab-btn.active {
  background: #FAF9F7;
  color: #1C1917;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Panel Container (Matches Portfolio Warm Stone Aesthetic) */
.panel {
  background: #FAF9F7;
  border: 1px solid #E5E0D8;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  background: #F2EFEB;
  border-bottom: 1px solid #E2DDD4;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-title {
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #292524;
  display: flex;
  align-items: center;
  gap: 7px;
}

.panel-body {
  padding: 16px 18px;
}

.csv-status {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #57534E;
  background: #FFFFFF;
  border: 1px solid #DDD7CC;
  padding: 3px 10px;
  border-radius: 9999px;
}

/* Filter Controls */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 12px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-search {
  flex: 1;
  min-width: 240px;
  max-width: 360px;
}

.control-group label {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  background: #EDE9E3;
  border: 1px solid #DDD7CC;
  border-radius: 9px;
  padding: 3px;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #57534E;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s;
}

.segmented button:hover:not(.active) {
  color: #1C1917;
}

.segmented button.active {
  background: #FAF9F7;
  color: #1C1917;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.table-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

/* Matrix Table (Matches Portfolio Warm Stone Tables) */
.table-wrap {
  border: 1px solid #E2DDD4;
  border-radius: var(--radius-sm);
  background: #FAF9F7;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.matrix-table th,
.matrix-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #E6E2D8;
  text-align: right;
  white-space: nowrap;
}

.matrix-table td {
  font-size: 12px;
}

#consensus-table {
  table-layout: fixed;
  min-width: 1060px;
}

.col-rank {
  width: 40px;
  padding-left: 6px !important;
  padding-right: 6px !important;
}

.col-ticker {
  width: 104px;
}

.col-issuer {
  width: 225px;
}

.col-overlap {
  width: 82px;
  padding-left: 6px !important;
  padding-right: 6px !important;
}

.matrix-table tbody tr:last-child td {
  border-bottom: none;
}

.matrix-table th {
  background: #EDE9E3;
  border-bottom: 1px solid #DDD7CC;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #57534E;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 2;
}

.matrix-table th:hover {
  background: #E6E2D8;
  color: #1C1917;
}

.matrix-table th.sorted {
  color: #1C1917;
  background: #D6CEBF;
}

.matrix-table th.left,
.matrix-table td.left {
  text-align: left;
}

.matrix-table th.center,
.matrix-table td.center {
  text-align: center;
}

.matrix-table tbody tr {
  background: #FAF9F7;
  cursor: pointer;
  transition: background 0.12s;
}

.matrix-table tbody tr:hover td {
  background: #F2EFEB;
}

.ticker-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #292524;
  background: #EDE9E3;
  border: 1px solid #DDD7CC;
  padding: 3px 7px;
  border-radius: 6px;
  min-width: 48px;
  text-align: center;
}

.ticker-badge.missing {
  color: #78716C;
  background: #F5F2EC;
  border-color: #E6E2D8;
}

.opt-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  margin-left: 5px;
  background: var(--amber-bg);
  color: var(--amber);
}

.issuer-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.issuer-cell-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.issuer-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fo-10k-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #166534;
  background: rgba(220, 252, 231, 0.72);
  border: 1px solid #BBF7D0;
  padding: 2px 6px;
  border-radius: 5px;
  text-decoration: none;
  line-height: 1.3;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.fo-10k-link:hover {
  background: #DCFCE7;
  border-color: #86EFAC;
  color: #14532D;
}

.fo-10k-link--modal {
  font-size: 11px;
  padding: 4px 10px;
}

.overlap-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 9999px;
  background: rgba(220, 252, 231, 0.75);
  color: #065f46;
}

.overlap-pill.solo {
  background: rgba(244, 244, 245, 0.60);
  color: #6b7280;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

.wt-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  border-left: 1px solid #E2DDD4;
  border-right: 1px solid #EAE6DF;
}

.matrix-table th.fund-col,
.matrix-table td.fund-col {
  padding-left: 5px;
  padding-right: 5px;
  text-align: center;
}

.matrix-table th.fund-col {
  white-space: normal;
  line-height: 1.25;
  font-size: 10px;
  vertical-align: middle;
}

.matrix-table td.peers-cell {
  white-space: normal;
  min-width: 240px;
}

.wt-empty {
  color: #A8A29E;
}

/* Fund Cards Grid */
.fund-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 1240px) {
  .fund-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .fund-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .fund-cards-grid {
    grid-template-columns: 1fr;
  }
}

.fund-card {
  background: #FAF9F7;
  border: 1px solid #E5E0D8;
  border-radius: 12px;
  padding: 14px 15px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.fund-card:hover {
  border-color: #D6CEBF;
  background: #F2EFEB;
}

.fund-card.active {
  background: #F2EFEB;
  border-color: #9C9180;
  box-shadow: 0 2px 8px rgba(120, 113, 108, 0.15);
}

.fund-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.fund-card-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fund-card-legal {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fund-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 12px;
}

.fund-card-stats span {
  display: block;
  font-size: 9.5px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  color: var(--text3);
}

.fund-card-stats strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--text);
}

.peer-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.peer-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #F2EFEB;
  color: #44403C;
  border: 1px solid #DDD7CC;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.peer-pill-wt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: #065f46;
}

.edgar-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.edgar-link:hover {
  text-decoration: underline;
}

/* Buttons (Matches Portfolio Builder) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #E5E7EB;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 11.5px;
}

/* Methodology Callout (Matches Portfolio Builder Bottom Notice) */
.fo-notice-wrap {
  max-width: 1480px;
  margin: 16px auto 36px;
  padding: 0 20px;
}

.fo-notice-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-left: 3px solid #0284C7;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 12.5px;
  color: #64748B;
  line-height: 1.55;
}

.fo-notice-box strong {
  color: #0F172A;
  font-weight: 600;
}

.fo-notice-box code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text2);
}

/* Modal (Matches Portfolio Builder Modal + sits above site-header) */
.portfolio-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  padding: 16px;
}

.portfolio-modal-backdrop.hidden {
  display: none !important;
}

.portfolio-modal-card {
  background: #FFFFFF;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  width: 100%;
  max-width: 780px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}

.portfolio-modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.portfolio-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.portfolio-modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text3);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}

.portfolio-modal-close:hover {
  color: var(--text);
  background: var(--surface2);
}

.portfolio-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}

.portfolio-modal-footer {
  padding: 12px 20px;
  background: var(--surface2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 768px) {
  .top-header {
    padding: 18px 14px 10px;
    gap: 10px;
  }
  .page-title {
    font-size: 26px;
  }
  .portfolio-save-tip {
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 8px;
    width: 100%;
  }
  .fo-workspace {
    padding: 10px 12px 20px;
  }
  .panel-body {
    padding: 12px;
  }
  .fo-notice-wrap {
    padding: 0 12px;
  }
  .fo-tabs-wrap {
    justify-content: stretch;
  }
  .tabs-row {
    width: 100%;
  }
  .tab-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
  }
  .control-search {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 100%;
  }
  .search-input {
    font-size: 16px;
  }
  .portfolio-modal-card {
    max-height: 90dvh;
  }
}

/* ==========================================================================
   13F Historical Filings Tab
   ========================================================================== */
.history-fund-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.history-fund-pill {
  border: 1px solid #DDD7CC;
  background: #FAF9F7;
  color: #44403C;
  border-radius: 9999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.history-fund-pill:hover {
  border-color: #34B59D;
  color: #1C1917;
}

.history-fund-pill.active {
  background: #0F172A;
  color: #FFFFFF;
  border-color: #0F172A;
}

.history-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .history-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .history-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.history-periods-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  margin-bottom: 10px;
}

.history-period-chip {
  flex: 0 0 auto;
  min-width: 152px;
  background: #FFFFFF;
  border: 1px solid #E2DDD4;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-period-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-period-date {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #1C1917;
  font-size: 11.5px;
}

.history-period-meta {
  color: #57534E;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
}

.history-period-flows {
  display: flex;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
}

.flow-in {
  color: #047857;
}

.flow-out {
  color: #BE123C;
}

.continuity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.continuity-current,
.continuity-constant {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.continuity-traded_in {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.continuity-exited {
  background: #FFF1F2;
  color: #BE123C;
  border: 1px solid #FECDD3;
}

.continuity-traded_in_out {
  background: #FFFBEB;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.hist-cell {
  min-width: 96px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  vertical-align: middle;
}

.hist-cell-main {
  font-weight: 700;
  line-height: 1.2;
}

.hist-cell-tag {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hist-tag-new {
  background: rgba(16, 185, 129, 0.22);
  color: #065F46;
}

.hist-tag-added {
  background: rgba(52, 211, 153, 0.18);
  color: #047857;
}

.hist-tag-trimmed {
  background: rgba(245, 158, 11, 0.18);
  color: #92400E;
}

.hist-tag-exited {
  background: rgba(244, 63, 94, 0.14);
  color: #BE123C;
}

.hist-tag-kept {
  color: #6B7280;
  font-weight: 600;
}

.hist-cell-exited {
  background: rgba(255, 241, 242, 0.72) !important;
  color: #BE123C;
  text-align: center !important;
}

#history-table th.col-quarter {
  min-width: 98px;
  text-align: right;
}

#history-table.matrix-table td {
  padding: 5px 8px;
}

#history-table.matrix-table .hist-cell-main {
  line-height: 1.1;
}

#history-table.matrix-table .hist-cell-tag {
  margin-top: 1px;
  padding: 0 4px;
}

.hist-loading-state {
  padding: 40px 20px;
  text-align: center;
  color: #57534E;
  font-size: 13px;
}

.hist-progress-card {
  max-width: 520px;
  margin: 0 auto;
  background: #FFFFFF;
  border: 1px solid #E2DDD4;
  border-radius: 12px;
  padding: 18px 20px;
  text-align: left;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.hist-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.hist-progress-title {
  font-size: 13px;
  font-weight: 700;
  color: #1C1917;
}

.hist-progress-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #0284C7;
}

.hist-progress-track {
  width: 100%;
  height: 8px;
  background: #EDE9E3;
  border-radius: 9999px;
  overflow: hidden;
}

.hist-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284C7, #10B981);
  border-radius: 9999px;
  transition: width 0.2s ease;
}

.hist-progress-sub {
  margin-top: 9px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #57534E;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Ranked Holdings Timeline Layout & Interactive Hover Spotlight */
.history-spotlight {
  margin: 4px 0 12px;
  padding: 9px 14px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #E2DDD4;
  border-left: 3px solid #1D4ED8;
  font-size: 12px;
  color: #44403C;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
}

.history-spotlight.is-active {
  background: #EFF6FF;
  border-color: #BFDBFE;
  border-left-color: #1D4ED8;
  color: #1E3A8A;
}

.hist-timeline-table {
  width: 100%;
  border-collapse: collapse;
}

.hist-timeline-table th {
  padding: 7px 10px;
  border-bottom: 1px solid #E6E2D8;
  white-space: nowrap;
  vertical-align: middle;
}

.hist-timeline-table td {
  padding: 4px 10px;
  border-bottom: 1px solid #E6E2D8;
  white-space: nowrap;
  vertical-align: middle;
}

.hist-timeline-table tbody tr:nth-child(even) td {
  background: rgba(242, 239, 235, 0.42);
}

.hist-timeline-table th.col-period,
.hist-timeline-table td.col-period {
  text-align: left;
  width: 96px;
  min-width: 96px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #1C1917;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #FAF9F7;
}

.hist-timeline-table tbody tr:nth-child(even) td.col-period {
  background: #F4F1EC;
}

.hist-timeline-table th.col-val,
.hist-timeline-table td.col-val {
  text-align: right;
  width: 104px;
  min-width: 104px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #1C1917;
  border-right: 1px solid #E2DDD4;
  padding-right: 14px;
}

.hist-timeline-table th.col-holdings-head {
  text-align: center;
  padding-left: 14px;
}

.hist-period-link {
  color: #1C1917;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hist-period-link:hover {
  color: #1D4ED8;
  text-decoration: underline;
}

.hist-tickers-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  padding-left: 6px;
}

.hist-tkr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: #1D4ED8;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11.5px;
  line-height: 1.25;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.1s ease, color 0.1s ease, opacity 0.1s ease, transform 0.1s ease;
  text-align: center;
  letter-spacing: -0.01em;
}

.hist-tkr-btn.is-current {
  background: #ECFDF5;
  color: #065F46;
  border-color: #A7F3D0;
}

.hist-tkr-btn.is-exited {
  background: #FFF1F2;
  color: #BE123C;
  border-color: #FECDD3;
}

.hist-tkr-btn.is-unnamed {
  font-size: 11px;
}

.hist-tkr-btn.is-dimmed {
  opacity: 0.2;
}

.hist-timeline-table.has-hover .hist-tkr-btn:not(.is-match) {
  opacity: 0.16;
}

.hist-tkr-btn.is-match,
.hist-tkr-btn:hover {
  background: #047857;
  color: #FFFFFF !important;
  border-color: #065F46;
  opacity: 1 !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.25);
  text-decoration: none;
}

.hist-tkr-btn.is-exited.is-match,
.hist-tkr-btn.is-exited:hover {
  background: #BE123C;
  color: #FFFFFF !important;
  border-color: #9F1239;
  box-shadow: 0 2px 6px rgba(190, 18, 60, 0.25);
}

.hist-tkr-btn.is-filter-match {
  box-shadow: inset 0 0 0 1px currentColor;
}

.hist-timeline-table.has-hover .hist-tkr-btn.is-filter-match.is-match {
  background: #047857;
  color: #FFFFFF !important;
  border-color: #065F46;
}

.hist-timeline-table.has-hover .hist-tkr-btn.is-exited.is-filter-match.is-match {
  background: #BE123C;
  color: #FFFFFF !important;
  border-color: #9F1239;
}
