.mw-wiki-table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: 100%;
}

.mw-wiki-table th,
.mw-wiki-table td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: 0.5rem 0.75rem;
    vertical-align: top;
}

.mw-wiki-table th {
    background: var(--mud-palette-background-grey);
    font-weight: 600;
}

/* View-page article layout — article column + sticky table-of-contents sidebar. Collapses to a single
   column below 960px, where the TOC (a native <details>) stacks above the article and can be folded. */
.mw-wiki-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 2.5rem;
    align-items: start;
}

.mw-wiki-layout--no-toc {
    grid-template-columns: minmax(0, 1fr);
}

.mw-wiki-article {
    min-width: 0;
    max-width: 56rem;
}

.mw-wiki-toc {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    font-size: 0.875rem;
    border-left: 1px solid var(--mud-palette-lines-default);
    padding-left: 1rem;
}

.mw-wiki-toc summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 0.5rem;
    list-style: none;
}

.mw-wiki-toc a {
    display: block;
    padding: 2px 0;
    color: var(--mud-palette-text-secondary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mw-wiki-toc a:hover {
    color: var(--mud-palette-primary);
}

.mw-wiki-toc-level-2 {
    padding-left: 0.85rem;
}

.mw-wiki-toc-level-3 {
    padding-left: 1.7rem;
}

.mw-wiki-toc-level-4,
.mw-wiki-toc-level-5,
.mw-wiki-toc-level-6 {
    padding-left: 2.5rem;
}

@media (max-width: 960px) {
    .mw-wiki-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .mw-wiki-toc {
        position: static;
        max-height: none;
        border-left: none;
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 8px;
        padding: 0.75rem 1rem;
        order: -1;
    }

    .mw-wiki-toc summary {
        margin-bottom: 0;
        list-style: disclosure-closed;
    }

    .mw-wiki-toc[open] summary {
        margin-bottom: 0.5rem;
        list-style: disclosure-open;
    }
}

.mw-wiki-import-drop-zone {
    min-height: 220px;
}

.mw-wiki-import-section-main {
    min-width: 0;
}

.mw-wiki-import-preview {
    color: var(--mud-palette-text-secondary);
    white-space: pre-line;
}
