/* Shared tables and modal shells. Component files keep only their own layout. */
:root {
    scrollbar-gutter: stable;
}
:root table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    color: var(--text, #291f28);
    font-size: 13px;
    line-height: 1.6;
    --bs-table-color: var(--text, #291f28);
    --bs-table-bg: var(--surface, #fff);
    --bs-table-border-color: var(--border, #e8dedf);
    --bs-table-hover-color: var(--text, #291f28);
    --bs-table-hover-bg: var(--bg, #fbf7f2);
}
:root table :is(th, td) {
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid var(--border, #e8dedf);
    color: inherit;
    vertical-align: top;
    text-align: start;
    overflow-wrap: anywhere;
}
:root table .badge {
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.4;
    white-space: normal;
}
:root table thead th {
    background: var(--lavender, #eaddf0);
    color: var(--plum, #3d1235);
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}
:root .table-scroll table :is(th, td) {
    min-width: 120px;
}
:root table tbody tr:last-child > * {
    border-bottom: 0;
}
:root table tbody tr:has(input[type='checkbox']:checked) > * {
    background: var(--lavender, #eaddf0);
}
:root :is(.table-responsive, .table-scroll) {
    min-width: 0;
    max-width: 100%;
    overflow: auto;
    overscroll-behavior-x: contain;
    border: 1px solid var(--border, #e8dedf);
    border-radius: 12px;
    background: var(--surface, #fff);
    scrollbar-color: var(--plum, #3d1235) var(--lavender, #eaddf0);
}
:root :is(.table-responsive, .table-scroll):focus-visible {
    outline: 2px solid var(--coral-dark, #b73528);
    outline-offset: 3px;
}
.table-scroll-hint {
    margin: 8px 0;
    color: var(--muted, #756a72);
    font-size: 12px;
    line-height: 1.6;
}
.table-scroll-hint[hidden] {
    display: none;
}
:root .revision-data {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 12px;
}
:root :is(.media-dialog, .confirmation-dialog) {
    box-sizing: border-box;
    width: min(var(--dialog-width, 940px), calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--border, #e8dedf);
    border-radius: 16px;
    background: var(--surface, #fff);
    color: var(--text, #291f28);
    font:
        13px/1.7 Manrope,
        Arial,
        sans-serif;
    box-shadow: 0 24px 80px #291f2838;
    overflow: hidden;
}
:root :is(.media-dialog, .confirmation-dialog)[open] {
    display: flex;
    flex-direction: column;
}
:root .media-preview-dialog {
    --dialog-width: 760px;
}
:root .confirmation-dialog {
    --dialog-width: 520px;
}
:root dialog::backdrop,
.admin-menu-backdrop {
    background: #291f2899;
    backdrop-filter: blur(3px);
}
body:has(dialog[open]) {
    overflow: hidden;
}
:root :is(.media-dialog, .confirmation-dialog) > header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border, #e8dedf);
    background: var(--surface, #fff);
    z-index: 2;
}
:root :is(.media-dialog, .confirmation-dialog) h2 {
    margin: 4px 0;
    font: 600 24px/1.3 var(--font-heading);
    color: var(--plum, #3d1235);
    overflow-wrap: anywhere;
}
:root :is(.media-dialog, .confirmation-dialog) > header > button {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--border, #e8dedf);
    border-radius: 10px;
    background: var(--lavender, #eaddf0);
    color: var(--plum, #3d1235);
    cursor: pointer;
}
:root :is(.dialog-body, .media-dialog-body) {
    min-height: 0;
    padding: 24px;
    overflow: auto;
    overscroll-behavior: contain;
}
:root :is(.dialog-body, .media-dialog-body) > p:first-child {
    margin-top: 0;
}
:root :is(.dialog-body, .media-dialog-body) > p:last-child {
    margin-bottom: 0;
}
:root .dialog-actions {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin: 0;
    padding: 16px 24px;
    border-top: 1px solid var(--border, #e8dedf);
    background: var(--surface, #fff);
}
:root .dialog-actions [role='status'] {
    flex: 1;
    min-width: 0;
}
:root .confirmation-dialog .dialog-body {
    overflow-wrap: anywhere;
}
@media (max-width: 600px) {
    :root table {
        font-size: 14px;
    }
    :root :is(.admin-records, .table-cards) strong {
        font-size: inherit;
    }
    :root table :is(th, td) {
        padding: 12px;
    }
    :root :is(.admin-records, .table-cards),
    :root :is(.admin-records, .table-cards) > tbody {
        display: block;
        width: 100%;
        min-width: 0;
        margin: 0;
    }
    :root :is(.admin-records, .table-cards, .home-layout-table) > thead {
        display: table-header-group;
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
    :root :is(.admin-records, .table-cards) > tbody {
        display: grid;
        gap: 12px;
    }
    :root :is(.admin-records, .table-cards) > tbody > tr {
        display: block;
    }
    :root :is(.admin-records, .table-cards, .home-layout-table) > tbody > tr {
        padding: 14px;
        border: 1px solid var(--border, #e8dedf);
        border-radius: 12px;
        background: var(--surface, #fff);
    }
    :root :is(.admin-records, .table-cards) > tbody > tr > :is(td, th[scope='row']) {
        display: block;
        width: 100%;
        min-width: 0;
        padding: 9px 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    :root :is(.admin-records, .table-cards) > tbody > tr > :is(td, th[scope='row']) + * {
        border-top: 1px solid var(--border, #e8dedf);
    }
    :root :is(.admin-records, .table-cards) > tbody > tr > [data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        color: var(--muted, #756a72);
        font-size: 12px;
        font-weight: 600;
    }
    :root .home-layout-table [data-label]::before {
        color: var(--muted, #756a72);
        font-size: 12px;
    }
    :root :is(.table-responsive, .table-scroll):has(> :is(.admin-records, .table-cards, .home-layout-table)) {
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    :root :is(.media-dialog, .confirmation-dialog) {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 14px;
    }
    :root :is(.media-dialog, .confirmation-dialog) > header,
    :root :is(.dialog-body, .media-dialog-body),
    :root .dialog-actions {
        padding: 16px;
    }
    :root :is(.media-dialog, .confirmation-dialog) h2 {
        font-size: 21px;
    }
    :root .confirmation-dialog .dialog-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }
}
@media print {
    :root .table-scroll table :is(th, td) {
        min-width: 0;
    }
    :root :is(.table-responsive, .table-scroll) {
        overflow: visible;
        border: 0;
    }
    .table-scroll-hint,
    .confirmation-dialog {
        display: none !important;
    }
}
/* A single action opens the shared, keyboard-accessible modal shell. */
.article-share {
    margin: 20px 0;
}
:root .share-dialog {
    --dialog-width: 520px;
    border-radius: 10px;
    font-family: var(--font-body);
}
.share-material-title {
    font-weight: 600;
    line-height: 1.5;
}
.share-services {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}
.share-services .button {
    justify-content: flex-start;
    gap: 12px;
    min-height: 46px;
}
.share-services .fa-brands {
    font-size: 20px;
    width: 22px;
    text-align: center;
}
.share-copy {
    width: 100%;
    margin-top: 10px;
}
.share-status {
    color: var(--muted);
    margin: 12px 0 0;
    line-height: 1.5;
}
.share-status:empty {
    display: none;
}
.share-dialog input[readonly] {
    text-overflow: ellipsis;
}
@media (max-width: 600px) {
    :root .share-dialog > header,
    .share-dialog .dialog-body {
        padding: 16px;
    }
    :root .share-dialog h2 {
        font-size: 21px;
    }
    .share-services {
        gap: 8px;
    }
    .share-services .button {
        padding: 10px;
        font-size: 13px;
    }
}

/* Shared page navigation for the portal, account and administration. */
.back-to-top {
    position: fixed;
    right: calc(18px + env(safe-area-inset-right, 0px));
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid var(--border, #e5dce0);
    border-radius: 50%;
    background: var(--surface, #fff);
    color: var(--plum, var(--bs-primary, #84364f));
    box-shadow: 0 3px 16px #0002;
    cursor: pointer;
}
.back-to-top[hidden] {
    display: none;
}
.back-to-top svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke-width: 2.5;
}
.back-to-top-track {
    stroke: currentColor;
    opacity: 0.15;
}
.back-to-top-progress {
    stroke: currentColor;
    stroke-dasharray: 100;
    stroke-dashoffset: calc(100 - var(--scroll-progress, 0));
    transform: rotate(-90deg);
    transform-origin: center;
}
.back-to-top i {
    font-size: 17px;
}
.back-to-top:hover {
    background: var(--plum, var(--bs-primary, #84364f));
    color: #fff;
    border-color: currentColor;
}
.back-to-top:focus-visible {
    outline: 3px solid var(--plum, var(--bs-primary, #84364f));
    outline-offset: 4px;
}
@media (max-width: 600px) {
    .back-to-top {
        width: 48px;
        height: 48px;
        right: calc(12px + env(safe-area-inset-right, 0px));
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

/* One paginator for public pages, account and administration. */
:root .pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 24px 0;
    padding: 0;
    font-size: 14px;
}
:root .pagination-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
:root .pagination :is(.pagination-page, .pagination-control) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--border, #e8dedf);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--plum, #79334f);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}
:root .pagination a:hover {
    border-color: var(--plum, #79334f);
    background: var(--lavender, #f6edf1);
    color: var(--plum, #79334f);
}
:root .pagination [aria-current='page'] {
    border-color: var(--plum, #79334f);
    background: var(--plum, #79334f);
    color: var(--on-primary, #fff);
}
:root .pagination [aria-disabled='true'] {
    background: var(--bg, #fbf7f2);
    color: var(--muted, #756a72);
    opacity: 0.65;
}
:root .pagination-ellipsis {
    padding: 0 2px;
    color: var(--muted, #756a72);
}
@media (max-width: 600px) {
    :root .pagination {
        justify-content: space-between;
        gap: 10px;
    }
    :root .pagination-pages {
        order: 3;
        flex-basis: 100%;
        gap: 4px;
    }
    :root .pagination .pagination-page {
        min-width: 32px;
        padding-inline: 6px;
    }
}
