.iv-page {
    background: #f4f6fa;
    padding: 40px 24px 64px;
  }

  .iv-hero {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 28px;
  }

  .iv-hero h1 {
    font-size: 40px;
    font-weight: 800;
    margin: 0 0 8px;
    color: #111827;
  }

  .iv-hero p {
    font-size: 15px;
    color: #5a6472;
    margin: 0;
  }

  /* ================= Category filter tabs ================= */
.iv-tabs-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 0 auto 32px;
  position: relative;
  z-index: 200;
}

/* Soft white glow behind the pill, fading outward so content scrolling
   underneath softens gradually instead of a hard cut line */
.iv-tabs-wrap::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -28px;
  right: -28px;
  bottom: -5px;
  background: radial-gradient(
    ellipse 70% 100% at center,
    rgba(244, 246, 250, 1) 0%,
    rgba(245, 246, 250, 0.75) 45%,
    rgba(245, 246, 250, 0) 100%
  );
  z-index: -1;
  pointer-events: none;
}

 /* Clean floating white pill with a soft glow instead of glass blur */
 .iv-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: #ffffff;
  border-radius: 0.75rem;   
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;          
  width: fit-content;
  max-width: 100%;
}
.iv-tabs-bar .iv-tab {
  flex: 0 0 auto;
  cursor: pointer;
  border: none;
  border-radius: 0.5rem;
  background-color: transparent;
  padding-inline: 1rem;     
  padding-block: 0.5rem;    
  font-weight: 600;
  font-size: 14px;          
  white-space: nowrap;
  color: #000000;
  transition: all 300ms ease;
}

  .iv-tabs-bar .iv-tab:hover {
    background-color: transparent;
    color: #4f46e5;
  }

  .iv-tabs-bar .iv-tab.active {
    background: var(--gradient-button-primary, linear-gradient(135deg, #6366f1, #4f46e5));
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
  }

  .iv-tabs-bar .iv-tab.active:hover {
    background: var(--gradient-button-primary-hover, linear-gradient(135deg, #6366f1, #4f46e5));
  }

  .iv-toggle {
    display: inline-flex;
    background: #f1f3f7;
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 0;
    max-width: 100%;
    overflow-x: auto;
  }

  .iv-toggle span {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    white-space: nowrap;
  }

  .iv-toggle span.is-active {
    background: #ffffff;
    color: #1c2430;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  .iv-two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 20px;
    width: 100%;
    margin: 0 auto 24px;
  }
  
  .iv-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title    toggle"
      "subtitle subtitle"
      "body     body";
    column-gap: 12px;
    background: #ffffff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(20, 30, 60, 0.06);
    min-width: 0;
  }

  .iv-card h2 {
    grid-area: title;
    align-self: center;
    font-size: 19px;
    margin: 0;
    color: #111827;
  }

  .iv-card .iv-subtitle {
    grid-area: subtitle;
    font-size: 13px;
    color: #6b7280;
    margin: 4px 0 14px;
  }

  .iv-card > .iv-toggle {
    grid-area: toggle;
    align-self: center;
    justify-self: end;
  }

  .iv-card > .iv-table-scroll,
  .iv-card > .iv-performance-columns {
    grid-area: body;
  }

  .iv-full-width-card {
    width: 100%;
    margin: 0 auto 24px;
    background: #ffffff;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 2px 10px rgba(20, 30, 60, 0.06);
  }

  .iv-full-width-card h2 {
    font-size: 19px;
    margin: 0 0 4px;
    color: #111827;
  }

  .iv-full-width-card .iv-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 14px;
  }

  .iv-table-scroll {
    max-height: 340px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: auto;
  }

  .iv-table-scroll::-webkit-scrollbar {
    width: 6px;
  }

  .iv-table-scroll::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
  }

  .iv-table-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
  }

  .iv-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
  }

  /* Shared table styling */
  .iv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    table-layout: fixed;
  }
  .iv-table,
  .iv-table th,
  .iv-table td {
    box-sizing: border-box;
  }

  .iv-table th {
    text-align: left;
    padding: 8px 14px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    /* color: #8a93a3; */
    border-bottom: 1px solid #eef0f4;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .iv-sort-btns {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
    margin-left: 6px;
    line-height: 1;
  }

  .iv-sort-btn {
    font-size: 14px;
    font-weight: 700;
    color: #c3c9d3;
    cursor: pointer;
    user-select: none;
    line-height: 0.9;
  }

  .iv-sort-btn:hover {
    color: #8a93a3;
  }

  .iv-sort-btn.is-active {
    color: #3457d5;
  }

  .iv-table td {
    padding: 9px 14px;
    vertical-align: middle;
    border-bottom: 1px solid #f2f4f7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #ivEpsScroll {
    overflow-x: hidden;
  }

  #iv-eps-table {
    table-layout: fixed;
    width: 100%;
  }

  #iv-eps-table td {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  #iv-eps-table th {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    line-height: 1.3;
  }

  #iv-eps-table td:nth-child(2) {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.35;
  }

  #ivValuationScroll,
  #ivEmaScroll {
    max-height: 340px;
    overflow-y: auto;
    overflow-x: auto;
  }
  #iv-valuation-table,
  #iv-ema-table {
    table-layout: auto;
    width: auto;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }
  #iv-valuation-table th,
  #iv-ema-table th {
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
    border-bottom: 1px solid #eef0f4;
    color: #4b5563;
    font-weight: 700;
  }
  #iv-valuation-table td,
  #iv-ema-table td {
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
    border-bottom: 1px solid #f2f4f7;
    color: #1f2937;
  }

  #ivValuationWrapper .datatable-container,
  #ivEmaWrapper .datatable-container,
  #ivValuationWrapper .datatable-wrapper,
  #ivEmaWrapper .datatable-wrapper {
    overflow: visible !important;
    max-height: none !important;
  }

  /* Rank and EPS Growth hold short fixed-length values (a number, a percent) */
  #iv-eps-table th:nth-child(1),
  #iv-eps-table td:nth-child(1) {
    text-align: left;
    padding-left: 6px;
    padding-right: 6px;
  }

  #iv-eps-table th:nth-child(3),
  #iv-eps-table td:nth-child(3) {
    text-align: right;
    padding-left: 6px;
    padding-right: 6px;
  }

  /* Give the Index Name column in the EPS table maximum breathing room */
  #iv-eps-table th:nth-child(2),
  #iv-eps-table td:nth-child(2) {
    padding-left: 8px;
    padding-right: 6px;
  }

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

  .iv-text-right {
    text-align: right;
  }

  .iv-index-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.2s ease, color 0.2s ease;
}

.iv-index-link:hover {
  transform: scale(1.03);
}

  .iv-index-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    border-radius: 6px;
    vertical-align: middle;
    flex-shrink: 0;
  }

  .iv-rank-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    background: #eef1f6;
    color: #3a4250;
    flex-shrink: 0;
  }

  .iv-rank-circle.rank-1 { background: #f6c85b; }
  .iv-rank-circle.rank-2 { background: #c9ccd3; }
  .iv-rank-circle.rank-3 { background: #e3a97a; }

  .iv-value-up {
    color: #1c9e63;
    font-weight: 600;
  }

  .iv-value-down {
    color: #d0384a;
    font-weight: 600;
  }

  .iv-performance-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .iv-performance-box {
    background: #ffffff;
    border: 1px solid #eef0f4;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(20, 30, 60, 0.05);
    min-width: 0;
  }

  .iv-performance-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
  }

  .iv-performance-slider {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 4px;
    scroll-behavior: auto;
    max-height: 340px;
  }

  .iv-performance-slider::-webkit-scrollbar {
    width: 6px;
  }

  .iv-performance-slider::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
  }

  .iv-performance-slider::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
  }

  .iv-performance-slider::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
  }

  .iv-perf-card {
    flex: 0 0 auto;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    min-height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .iv-perf-card-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    white-space: normal;
    line-height: 1.3;
    min-width: 0;
  }

  .iv-perf-card-name span,
  .iv-perf-card-name a {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .iv-perf-card-value {
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .iv-badge {
    display: inline-block;
    width: 104px;
    text-align: center;
    padding: 4px 0;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
  }

  .iv-badge.status-overvalued  { background: #fdeced; color: #d0384a; }
  .iv-badge.status-undervalued { background: #e6f7ee; color: #1c9e63; }
  .iv-badge.status-neutral     { background: #e9f0fd; color: #3457d5; }

  .iv-empty-row td {
    text-align: center;
    color: #9aa2b1;
    padding: 24px 6px;
  }

  .iv-empty-row {
    text-align: center;
    color: #9aa2b1;
    padding: 24px 6px;
  }

  /* ---- Tablet / small desktop (<=900px): stack the two-column grid ---- */
  @media (max-width: 900px) {
    .iv-two-col-grid {
      grid-template-columns: 1fr;
    }
  }

  /* ---- Large phone / small tablet (<=768px) ---- */
  @media (max-width: 768px) {
    .iv-page {
      padding: 28px 16px 48px;
    }

    .iv-hero h1 {
      font-size: 30px;
    }

    .iv-hero p {
      font-size: 14px;
    }

    .iv-tabs-bar {
      flex-wrap: nowrap;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      width: 100%;
      max-width: 100%;
      min-width: 0;
    }

    .iv-tabs-bar::-webkit-scrollbar {
      display: none;
    }

    .iv-tabs-bar .iv-tab {
      padding-inline: 1.1rem;
      padding-block: 0.6rem;
      font-size: 14px;
    }

    .iv-card,
    .iv-full-width-card {
      padding: 16px;
      border-radius: 12px;
    }

    .iv-card h2,
    .iv-full-width-card h2 {
      font-size: 17px;
    }

    .iv-performance-columns {
      grid-template-columns: 1fr;
    }
    .iv-card {
      grid-template-columns: 1fr;
      grid-template-areas:
        "title"
        "toggle"
        "subtitle"
        "body";
    }

    .iv-card > .iv-toggle {
      justify-self: start;
      margin-top: 6px;
      margin-bottom: 10px;
    }
  }

  /* ---- Phones (<=640px) ---- */
  @media (max-width: 640px) {
    .iv-badge {
      width: 84px;
      font-size: 11.5px;
      padding: 3px 0;
    }

    .iv-table {
      font-size: 12.5px;
    }

    .iv-table th,
    .iv-table td {
      padding: 8px 10px;
    }
  }

  /* ---- Very small phones (<=380px) ---- */
  @media (max-width: 380px) {
    .iv-hero h1 {
      font-size: 26px;
    }

    .iv-tabs-bar .iv-tab {
      padding-inline: 0.9rem;
      padding-block: 0.55rem;
      font-size: 13px;
    }

    .iv-perf-card-name {
      font-size: 12px;
    }

    .iv-perf-card-value {
      font-size: 12.5px;
    }
  }

  .skeleton {
    background: linear-gradient(90deg, #eef0f4 25%, #e4e7ed 37%, #eef0f4 63%);
    background-size: 400% 100%;
    animation: iv-skeleton-shimmer 1.4s ease infinite;
    border-radius: 4px;
    display: inline-block;
  }

  @keyframes iv-skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
  }