/* Responsive additions. Desktop declarations intentionally stay in base.html. */
.site-nav-toggle {
    display: none;
}

.site-nav .nav-submit {
    margin-left: 20px;
    border: 0;
    background: transparent;
    color: var(--nav-text);
    cursor: pointer;
    font-size: 13px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

main,
.card,
.page-header,
.page-header > *,
dl,
dd {
    min-width: 0;
}

dd,
.message,
.errors,
.active-filter-note,
.attachment-file-name,
.payment-purpose,
.event-changes,
.event-changes-detail {
    overflow-wrap: anywhere;
}

img,
video,
canvas {
    max-width: 100%;
    height: auto;
}

.action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.table-scroll:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.table-scroll > table {
    min-width: 680px;
}

.table-scroll.table-scroll-compact > table {
    min-width: 520px;
}

@media (max-width: 768px) {
    header.site-header {
        height: auto;
        min-height: 52px;
        padding: 0 16px;
        flex-wrap: wrap;
        align-content: center;
    }

    .site-header .brand {
        line-height: 52px;
    }

    .site-header > #theme-toggle {
        min-width: 44px;
        min-height: 44px;
        margin-left: auto;
    }

    .site-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin-left: auto;
        border: 0;
        border-radius: 4px;
        background: transparent;
        color: #fff;
        cursor: pointer;
        font-size: 22px;
        line-height: 1;
    }

    .site-nav-toggle:hover,
    .site-nav-toggle:focus-visible {
        background: rgba(255, 255, 255, .1);
        outline: none;
    }

    .site-nav {
        flex: 1 0 100%;
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        padding: 0 0 10px;
    }

    .js .site-nav:not(.is-open) {
        display: none;
    }

    .site-nav a,
    .site-nav .nav-submit,
    .site-nav #theme-toggle {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 44px;
        margin: 0;
        padding: 9px 8px;
        border-radius: 4px;
        text-align: left;
    }

    .site-nav a:hover,
    .site-nav .nav-submit:hover,
    .site-nav #theme-toggle:hover {
        background: rgba(255, 255, 255, .08);
        text-decoration: none;
    }

    .site-nav .nav-logout-form {
        display: block;
        width: 100%;
    }

    main {
        padding: 16px;
    }

    .page-header {
        gap: 10px 16px;
        flex-wrap: wrap;
    }

    .page-header h1 {
        overflow-wrap: anywhere;
    }

    .btn {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-sm {
        min-height: 40px;
        padding: 6px 10px;
    }

    .registry-tabs {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
    }

    .registry-tab,
    .registry-tab-group {
        flex: 0 0 auto;
        min-height: 40px;
        white-space: nowrap;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .pagination a,
    .pagination-disabled,
    .page-current {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }
}

@media (max-width: 600px) {
    main {
        padding: 12px;
    }

    .card {
        padding: 14px;
        margin-bottom: 14px;
    }

    .page-header {
        align-items: flex-start;
        margin-bottom: 12px;
    }

    .page-header h1 {
        flex: 1 0 100%;
        font-size: 19px;
    }

    .registry-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 4px;
        border-bottom: 0;
    }

    .registry-tab,
    .registry-tab.active {
        top: 0;
        border: 1px solid var(--border);
        border-radius: 6px;
        background: var(--surface);
        padding: 7px 10px;
    }

    dl,
    .allocation-totals {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }

    dl dt:not(:first-child) {
        margin-top: 10px;
    }

    dl dd {
        line-height: 1.45;
    }

    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select,
    textarea {
        min-width: 0;
        max-width: 100%;
        font-size: 16px;
    }

    .table-scroll > table,
    .table-scroll.table-scroll-compact > table {
        min-width: 560px;
    }

    .action-bar {
        align-items: stretch;
    }
}
