    html, body {
      height: 100%;
    }

    /* Sticky footer layout */
    body {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    /* This wrapper will take remaining height and push footer down */
    .site-content {
      flex: 1 0 auto;
    }

    /* Ensure footer participates in normal flow (avoid overlap) */
    footer {
      margin-top: auto;
      position: static !important; /* overrides absolute/fixed footers from base */
      z-index: 10;
    }

    /* Force sidebar cards to stack in ONE column */
    .sidebar-stack {
      display: flex;
      flex-direction: column;
    }

    .sidebar-stack > .card {
      width: 100%;
    }

    /* Custom tab styling for better UX */
    .nav-tabs {
      border-bottom: 2px solid #dee2e6;
      margin-bottom: 0;
    }

    .nav-tabs .nav-link {
      color: #495057;
      border: none;
      border-bottom: 3px solid transparent;
      padding: 1rem 1.5rem;
      font-weight: 500;
      transition: all 0.3s ease;
    }

    .nav-tabs .nav-link:hover {
      border-bottom: 3px solid #0d6efd;
      color: #0d6efd;
    }

    .nav-tabs .nav-link.active {
      color: #0d6efd;
      background-color: transparent;
      border-bottom: 3px solid #0d6efd;
    }

    .tab-content {
      background: white;
      padding: 2rem;
      border: 1px solid #dee2e6;
      border-top: none;
    }

    /* Metadata grid styling */
    .metadata-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      gap: 1.5rem;
      margin-bottom: 2rem;
    }

    .metadata-item {
      padding: 1.25rem;
      background: #f8f9fa;
      border-left: 4px solid #0d6efd;
      border-radius: 4px;
    }

    .metadata-label {
      font-size: 0.75rem;
      text-transform: uppercase;
      color: #6c757d;
      font-weight: 600;
      letter-spacing: 0.5px;
      margin-bottom: 0.5rem;
    }

    .metadata-value {
      font-size: 1rem;
      color: #212529;
      font-weight: 500;
    }

    /* Study structure improvements */
    .structure-section {
      margin-bottom: 1.5rem;
    }

    .event-button, .instrument-button {
      width: 100%;
      text-align: left;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 1rem 1.25rem;
      font-size: 1rem;
      transition: all 0.2s ease;
    }

    .event-button:hover, .instrument-button:hover {
      background-color: #e7f1ff;
    }

    .event-button::after, .instrument-button::after {
      content: "▼";
      font-size: 0.8rem;
      transition: transform 0.2s ease;
    }

    .event-button:not(.collapsed)::after,
    .instrument-button:not(.collapsed)::after {
      transform: rotate(180deg);
    }

    /* Badge styling for counts */
    .count-badge {
      background: #285aa4;
      color: white;
      padding: 0.25rem 0.6rem;
      border-radius: 12px;
      font-size: 0.8rem;
      font-weight: 600;
      margin-left: 0.5rem;
    }

    /* Info cards styling */
    .info-card {
      height: 100%;
      border: none;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
      transition: box-shadow 0.3s ease;
    }

    .info-card:hover {
      box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }

    /* Quick stats */
    .quick-stats {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 1rem;
      margin-bottom: 2rem;
    }

    .stat-card {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      padding: 1.5rem;
      border-radius: 8px;
      text-align: center;
    }

    .stat-value {
      font-size: 2rem;
      font-weight: 700;
      margin-bottom: 0.25rem;
    }

    .stat-label {
      font-size: 0.875rem;
      opacity: 0.9;
    }

    /* Table improvements */
    .variable-table {
      font-size: 0.9rem;
    }

    .variable-table thead th {
      background-color: #f8f9fa;
      font-weight: 600;
      position: sticky;
      top: 0;
      z-index: 10;
    }

    .variable-table tbody tr:hover {
      background-color: #f8f9fa;
    }

    /* Highlight.js code styling */
    .hljs {
      background:#f6f8fa !important;
      color:#24292e !important;
      padding:0 !important;
    }
    .hljs-keyword { color:#d73a49 !important; font-weight:bold !important; }
    .hljs-string { color:#032f62 !important; }
    .hljs-number { color:#005cc5 !important; }
    .hljs-comment { color:#6a737d !important; font-style:italic !important; }
    .hljs-function { color:#6f42c1 !important; }
    .hljs-variable { color:#e36209 !important; }
    .hljs-operator { color:#d73a49 !important; }
    .hljs-built_in, .hljs-literal { color:#005cc5 !important; }
    .hljs-title { color:#6f42c1 !important; font-weight:bold !important; }

    /* Responsive adjustments */
    @media (max-width: 768px) {
      .metadata-grid {
        grid-template-columns: 1fr;
      }

      .tab-content {
        padding: 1rem;
      }

      .nav-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
      }
    }

    /* DOI copy animation */
    @keyframes fadeIn {
      from { opacity: 0; transform: scale(0.95); }
      to { opacity: 1; transform: scale(1); }
    }

    .doi-copy-success {
      color: #ffffffff !important;
      animation: fadeIn 0.3s ease;
    }

/* ── Mobile: sidebar below main content ── */
@media (max-width: 991.98px) {
  .sidebar-stack {
    order: 2;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
  }
  .col-lg-9 {
    order: 1;
  }
}

@media (max-width: 991.98px) {
  .hero-actions {
    display: none !important;
  }
}