* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #13111c;
    color: #c4c0d5;
    min-height: 100vh;
    padding: 40px;
}

.container {
    background-color: #1c1a2e;
    border-radius: 20px;
    padding: 40px;
    max-width: 100%;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #ebe8f4;
    margin-bottom: 30px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
}

table {
    min-width: 1400px;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    table-layout: auto;
}

thead th {
    background: linear-gradient(135deg, #2a2545 0%, #322d50 100%);
    color: #9d97b8;
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 18px;
    text-align: left;
    border-bottom: 2px solid #3b3560;
    position: sticky;
    top: 0;
}

thead th .th-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

thead th:first-child {
    border-radius: 12px 0 0 0;
}

thead th:last-child {
    border-radius: 0 12px 0 0;
}

thead th.sorted-asc::after,
thead th.sorted-desc::after {
    margin-left: 8px;
    font-size: 0.75rem;
    color: #c9c4db;
}

thead th.sorted-asc::after {
    content: "▲";
}

thead th.sorted-desc::after {
    content: "▼";
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: rgba(139, 92, 246, 0.08);
}

tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid #2a2545;
    color: #c4c0d5;
    vertical-align: top;
}

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

tbody tr:last-child td:first-child {
    border-radius: 0 0 0 12px;
}

tbody tr:last-child td:last-child {
    border-radius: 0 0 12px 0;
}

/* Column hints — let auto layout decide, just set nowrap where needed */
td:nth-child(2)  { white-space: nowrap; }      /* Court */
td:nth-child(4)  { white-space: nowrap; }      /* Complaint */
td:nth-child(5)  { white-space: nowrap; }      /* Docket Number */
td:nth-child(6)  { white-space: nowrap; }      /* Date Filed */
td:nth-child(10) { white-space: nowrap; }      /* Class Period Start */
td:nth-child(11) { white-space: nowrap; }      /* Class Period End */

@media (max-width: 899px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 14px;
        border-radius: 12px;
    }

    h1 {
        font-size: 1.3rem;
        margin-bottom: 16px;
    }

    .modal-scroll-hint {
        display: block;
    }

    .table-wrapper {
        overflow-x: visible;
    }

    table {
        min-width: 0;
        width: 100%;
        table-layout: auto;
    }

    thead {
        display: none;
    }

    tbody,
    tbody tr,
    tbody td {
        display: block;
        width: 100%;
    }

    tbody tr {
        background: #232040;
        border: 1px solid #2a2545;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 4px 10px;
    }

    tbody tr:hover {
        background-color: #272246;
    }

    tbody td {
        padding: 8px 4px;
        border-bottom: 1px solid #2a2545;
        display: flex;
        gap: 8px;
        align-items: flex-start;
        white-space: normal;
        word-break: break-word;
        font-size: 0.82rem;
    }

    tbody td::before {
        content: attr(data-label);
        color: #6b6588;
        font-size: 0.68rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex: 0 0 110px;
        min-width: 110px;
    }

    tbody td:last-child {
        border-bottom: none;
        padding-bottom: 10px;
    }

    tbody tr:last-child td {
        border-radius: 0;
    }

    /* Override desktop column widths — nth-child specificity beats "tbody td" */
    td:nth-child(n) {
        width: 100%;
        white-space: normal;
    }

    /* Modal mobile */
    .modal {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        padding: 16px;
        margin: 0;
    }

    .modal h2 {
        font-size: 0.95rem;
        padding-right: 28px;
    }

    .modal-section h3 {
        font-size: 0.7rem;
    }

    .modal-section p {
        font-size: 0.82rem;
    }

    .modal-summary-content {
        padding: 12px 14px;
        font-size: 0.82rem;
    }

    .modal-table {
        min-width: 400px;
        font-size: 0.75rem;
    }

    .modal-table thead th {
        padding: 8px 10px;
        font-size: 0.68rem;
    }

    .modal-table tbody td {
        padding: 8px 10px;
    }

    .modal-grid-4 {
        grid-template-columns: 1fr 1fr;
    }

    .holdings-tabs {
        gap: 6px;
    }

    .holdings-tab {
        font-size: 0.72rem;
        padding: 5px 12px;
    }

    .table-footer {
        font-size: 0.75rem;
    }
}

/* Ticker badge */
.ticker {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.03em;
}

/* Link styling */
.case-link {
    display: inline-block;
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.78rem;
    padding: 5px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.case-link:hover {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.4);
}

/* Causes of action */
.causes {
    white-space: pre-line;
    font-size: 0.8rem;
    line-height: 1.6;
}

/* Case name emphasis */
.case-name {
    color: #ebe8f4;
    font-weight: 500;
}

/* Date styling */
.date {
    white-space: nowrap;
    color: #9d97b8;
}

/* Record count */
.table-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    font-size: 0.82rem;
    color: #6b6588;
}

/* Scrollbar styling */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #1c1a2e;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #3b3560;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #4c4575;
}

/* Detail button */
.detail-btn {
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    border: none;
    font-weight: 500;
    font-size: 0.78rem;
    padding: 5px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.detail-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.4);
}

/* Modal overlay */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

/* Modal */
.modal {
    background: #1c1a2e;
    border: 1px solid #3b3560;
    border-radius: 16px;
    padding: 32px;
    max-width: none;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal h2 {
    color: #ebe8f4;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 24px;
    padding-right: 32px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #6b6588;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #ebe8f4;
}

.modal-section {
    margin-bottom: 24px;
}

.modal-section h3 {
    color: #9d97b8;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.modal-section p {
    color: #c4c0d5;
    font-size: 0.88rem;
    line-height: 1.6;
}

/* Modal summary box */
.modal-summary-content {
    background: #232040;
    border-radius: 10px;
    padding: 16px 20px;
    border-left: 3px solid #7c3aed;
    text-align: justify;
}

/* Modal COA table */
.modal-table-wrapper {
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #2a2545;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.modal-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.modal-scroll-hint {
    display: none;
    font-size: 0.72rem;
    color: #9d97b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 8px;
    text-align: right;
}

.modal-table thead th {
    background: #232040;
    color: #9d97b8;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 16px;
    text-align: left;
    position: static;
}

.modal-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid #2a2545;
    color: #c4c0d5;
}

.modal-table tbody td:last-child {
    text-align: center;
    font-weight: 600;
    color: #a78bfa;
    width: 80px;
}

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

/* 4-column grid for purchaser/seller */
.modal-grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 12px;
}

.modal-card {
    background: #232040;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-card-label {
    color: #6b6588;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.modal-card-value {
    color: #ebe8f4;
    font-size: 0.92rem;
    font-weight: 500;
}

/* Holdings analysis tabs */
.holdings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.holdings-tab {
    background: #232040;
    color: #9d97b8;
    border: 1px solid #3b3560;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.holdings-tab:hover {
    background: #2a2545;
    color: #ebe8f4;
}

.holdings-tab.active {
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    border-color: transparent;
}

.holdings-tab-count {
    font-size: 0.75rem;
    color: #6b6588;
    margin-bottom: 10px;
}

.holdings-quarter-range {
    font-size: 0.75rem;
    color: #6b6588;
    margin: 2px 0 10px;
}

/* Modal footer with close button */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #2a2545;
}

.modal-close-btn {
    background: #2a2545;
    color: #c4c0d5;
    border: 1px solid #3b3560;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 8px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #3b3560;
    color: #ebe8f4;
}

/* Modal scrollbar */
.modal::-webkit-scrollbar {
    width: 6px;
}

.modal::-webkit-scrollbar-track {
    background: transparent;
}

.modal::-webkit-scrollbar-thumb {
    background: #3b3560;
    border-radius: 3px;
}

.modal::-webkit-scrollbar-thumb:hover {
    background: #4c4575;
}

/* Site footer */
.site-footer {
    text-align: center;
    padding: 24px 0 12px;
    font-size: 0.8rem;
    color: #6b6588;
}

.site-footer a {
    color: #9d97b8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: #ebe8f4;
}

.footer-sep {
    margin: 0 10px;
    color: #3b3560;
}

/* Content / markdown pages */
.content-page {
    max-width: 800px;
    margin: 0 auto;
}

.back-link {
    display: inline-block;
    color: #9d97b8;
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 24px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #ebe8f4;
}

.markdown-body {
    color: #c4c0d5;
    font-size: 0.92rem;
    line-height: 1.7;
}

.markdown-body h1 {
    color: #ebe8f4;
    font-size: 1.6rem;
    margin-bottom: 20px;
}

.markdown-body h2 {
    color: #ebe8f4;
    font-size: 1.2rem;
    margin-top: 28px;
    margin-bottom: 12px;
}

.markdown-body h3 {
    color: #ebe8f4;
    font-size: 1rem;
    margin-top: 20px;
    margin-bottom: 8px;
}

.markdown-body p {
    margin-bottom: 14px;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 14px;
    padding-left: 24px;
}

.markdown-body li {
    margin-bottom: 6px;
}

.markdown-body a {
    color: #a78bfa;
    text-decoration: none;
}

.markdown-body a:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

.markdown-body strong {
    color: #ebe8f4;
}

/* Navigation */
.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.site-nav-title {
    color: #ebe8f4;
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-nav-title:hover {
    color: #a78bfa;
}

.site-nav-links {
    display: flex;
    gap: 24px;
}

.site-nav-links a {
    color: #9d97b8;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.site-nav-links a:hover {
    color: #ebe8f4;
    background: rgba(139, 92, 246, 0.1);
}

.site-nav-links a.active {
    color: #fff;
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
}

/* Rankings page */
.rankings-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.ranking-card {
    background: #232040;
    border: 1px solid #2a2545;
    border-radius: 14px;
    padding: 28px;
}

.ranking-card h2 {
    color: #ebe8f4;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.ranking-card-subtitle {
    color: #6b6588;
    font-size: 0.78rem;
    margin-bottom: 20px;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.ranking-table thead th {
    color: #9d97b8;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #3b3560;
    background: transparent;
    position: static;
}

.ranking-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #2a2545;
    color: #c4c0d5;
    vertical-align: middle;
}

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

.ranking-table tbody tr:hover {
    background: rgba(139, 92, 246, 0.06);
}

.rank-number {
    color: #6b6588;
    font-weight: 600;
    font-size: 0.82rem;
}

.score-badge {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 4px 14px;
    border-radius: 20px;
}

.shares-value {
    color: #4ade80;
    font-weight: 600;
}

.ticker-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ranking-table .case-link {
    background: none;
    color: #ebe8f4;
    font-size: 0.88rem;
    padding: 0;
    border-radius: 0;
}

.ranking-table .case-link:hover {
    background: none;
    box-shadow: none;
    text-decoration: underline;
}

.clickable {
    cursor: pointer;
}

.ranking-empty {
    text-align: center;
    color: #6b6588;
    padding: 32px;
    font-size: 0.88rem;
}

/* Rankings mobile */
@media (max-width: 899px) {
    .site-nav {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .ranking-card {
        padding: 16px;
    }

    .ranking-table-wrapper {
        overflow-x: auto;
    }

    .ranking-table {
        min-width: 600px;
    }
}
