.tbrd-directory {
    --tbrd-border: #d6dee6;
    --tbrd-muted: #596774;
    --tbrd-surface: #f6f8fa;
    --tbrd-surface-strong: #eef3f7;
    --tbrd-accent: #075da8;
    --tbrd-accent-dark: #064a85;
    --tbrd-text: #17212b;
    color: var(--tbrd-text);
    margin: 2rem 0;
}

.tbrd-directory [hidden] {
    display: none !important;
}

/* The detail modal is moved to <body> when opened so it can sit above theme/page-builder layers. */
.tbrd-modal[hidden] {
    display: none !important;
}

.tbrd-heading h2 {
    margin: 0 0 .4rem;
}

.tbrd-heading p {
    color: var(--tbrd-muted);
    margin: 0;
    max-width: 75ch;
}

.tbrd-help {
    max-width: 85ch;
    margin: 1rem 0 1.25rem;
    border: 1px solid var(--tbrd-border);
    border-left: 4px solid var(--tbrd-accent);
    border-radius: .5rem;
    background: var(--tbrd-surface);
}

.tbrd-help summary {
    position: relative;
    padding: .85rem 2.75rem .85rem 1.1rem;
    cursor: pointer;
    color: var(--tbrd-text);
    font-size: 1.05rem;
    font-weight: 700;
    list-style: none;
}

.tbrd-help summary::-webkit-details-marker {
    display: none;
}

.tbrd-help summary::after {
    content: "+";
    position: absolute;
    top: 50%;
    right: 1.1rem;
    transform: translateY(-50%);
    color: var(--tbrd-accent);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1;
}

.tbrd-help[open] summary::after {
    content: "−";
}

.tbrd-help summary:hover {
    background: rgba(0, 0, 0, .025);
}

.tbrd-help summary:focus-visible {
    outline: 3px solid rgba(19, 107, 152, .35);
    outline-offset: 2px;
}

.tbrd-help-content {
    padding: 0 1.1rem 1rem;
    border-top: 1px solid var(--tbrd-border);
}

.tbrd-help-content p {
    margin: .8rem 0 0;
    color: var(--tbrd-text);
}

.tbrd-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding: 1.15rem;
    margin: 1.35rem 0 1rem;
    border: 1px solid var(--tbrd-border);
    border-radius: .65rem;
    background: var(--tbrd-surface);
    box-shadow: 0 1px 2px rgba(23, 33, 43, .04);
}

.tbrd-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 0;
}

.tbrd-field-search {
    grid-column: span 2;
}

.tbrd-field label {
    font-size: .92rem;
    font-weight: 700;
}

.tbrd-field input,
.tbrd-field select {
    box-sizing: border-box;
    width: 100%;
    min-height: 2.75rem;
    padding: .5rem .65rem;
    border: 1px solid #8795a2;
    border-radius: .35rem;
    background: #fff;
    color: var(--tbrd-text);
    font: inherit;
}

.tbrd-actions {
    display: flex;
    align-items: end;
    gap: .7rem;
}

.tbrd-actions button,
.tbrd-pagination button,
.tbrd-toolbar-actions button,
.tbrd-detail-button {
    box-sizing: border-box;
    min-height: 2.65rem;
    padding: .58rem .9rem;
    border: 1px solid var(--tbrd-accent);
    border-radius: .35rem;
    background: var(--tbrd-accent);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.tbrd-actions button:hover,
.tbrd-pagination button:hover,
.tbrd-toolbar-actions button:hover,
.tbrd-detail-button:hover {
    border-color: var(--tbrd-accent-dark);
    background: var(--tbrd-accent-dark);
    color: #fff;
}

.tbrd-button-secondary,
.tbrd-detail-button-secondary {
    background: #fff !important;
    color: var(--tbrd-accent) !important;
}

.tbrd-button-secondary:hover,
.tbrd-detail-button-secondary:hover {
    background: var(--tbrd-surface-strong) !important;
    color: var(--tbrd-accent-dark) !important;
}

.tbrd-actions button:focus-visible,
.tbrd-pagination button:focus-visible,
.tbrd-toolbar-actions button:focus-visible,
.tbrd-detail-button:focus-visible,
.tbrd-location-link:focus-visible,
.tbrd-modal-close:focus-visible,
.tbrd-field input:focus,
.tbrd-field select:focus {
    outline: 3px solid rgba(7, 93, 168, .25);
    outline-offset: 2px;
}

.tbrd-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: .9rem 0;
}

.tbrd-summary {
    font-weight: 650;
}

.tbrd-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .55rem;
}

.tbrd-toolbar-actions button {
    min-height: 2.35rem;
    padding: .45rem .7rem;
    font-size: .9rem;
}

.tbrd-action-status {
    min-height: 1.4em;
    color: var(--tbrd-muted);
    font-size: .9rem;
    margin: -.25rem 0 .5rem;
}

.tbrd-status {
    margin: .85rem 0;
    padding: 1rem;
    border-left: 4px solid var(--tbrd-accent);
    background: var(--tbrd-surface);
}

.tbrd-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--tbrd-border);
    border-radius: .55rem;
    background: #fff;
}

.tbrd-table {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    font-size: .95rem;
}

.tbrd-table th,
.tbrd-table td {
    padding: .82rem .78rem;
    border: 0;
    border-bottom: 1px solid var(--tbrd-border);
    text-align: left;
    vertical-align: top;
}

.tbrd-table th {
    background: var(--tbrd-surface-strong);
    color: var(--tbrd-text);
    font-size: .88rem;
    font-weight: 750;
    white-space: nowrap;
}

.tbrd-table tbody tr:last-child td {
    border-bottom: 0;
}

.tbrd-table tbody tr:hover {
    background: #fbfcfd;
}

.tbrd-table small {
    color: var(--tbrd-muted);
}

.tbrd-location-link {
    display: inline;
    padding: 0;
    border: 0;
    background: transparent;
    color: #8f1f78;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    line-height: inherit;
    text-align: left;
    text-decoration: underline;
    text-decoration-thickness: .06em;
    text-underline-offset: .14em;
}

.tbrd-location-link:hover {
    color: #681558;
}

.tbrd-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.1rem;
}

.tbrd-pagination button:disabled,
.tbrd-toolbar-actions button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.tbrd-modal-open {
    overflow: hidden;
}

.tbrd-modal {
    --tbrd-border: #d6dee6;
    --tbrd-muted: #596774;
    --tbrd-surface: #f6f8fa;
    --tbrd-surface-strong: #eef3f7;
    --tbrd-accent: #075da8;
    --tbrd-accent-dark: #064a85;
    --tbrd-text: #17212b;
    color: var(--tbrd-text);
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.tbrd-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 20, 31, .72);
}

.tbrd-modal-panel {
    position: relative;
    z-index: 1;
    width: min(880px, 100%);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: clamp(1.1rem, 3vw, 2rem);
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

.tbrd-modal-close {
    position: absolute;
    top: .65rem;
    right: .75rem;
    display: grid;
    width: 2.4rem;
    height: 2.4rem;
    place-items: center;
    padding: 0;
    border: 1px solid var(--tbrd-border);
    border-radius: 50%;
    background: #fff;
    color: var(--tbrd-text);
    cursor: pointer;
    font-size: 1.6rem;
    line-height: 1;
}

.tbrd-detail-header {
    padding-right: 2.5rem;
    border-bottom: 1px solid var(--tbrd-border);
    margin-bottom: 1rem;
}

.tbrd-detail-header h2 {
    margin: .15rem 0 .35rem;
    font-size: clamp(1.45rem, 4vw, 2rem);
    line-height: 1.2;
}

.tbrd-detail-parent {
    margin-top: 0;
    color: var(--tbrd-muted);
}

.tbrd-detail-eyebrow {
    margin: 0;
    color: var(--tbrd-accent);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.tbrd-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    margin: 0 0 1.3rem;
}

.tbrd-detail-status {
    display: inline-block;
    margin: 0 0 1rem;
    padding: .3rem .55rem;
    border-radius: .35rem;
    background: #fff4d6;
    color: #684800;
    font-weight: 700;
}

.tbrd-detail-map-section {
    margin: 0 0 1.4rem;
}

.tbrd-detail-map-section h3 {
    margin: 0 0 .65rem;
    font-size: 1.08rem;
}

.tbrd-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}


.tbrd-detail-grid h3 {
    margin: 0 0 .65rem;
    font-size: 1.08rem;
}

.tbrd-detail-list {
    margin: 0;
}

.tbrd-detail-list > div {
    display: grid;
    grid-template-columns: minmax(8rem, .8fr) minmax(0, 1.5fr);
    gap: .75rem;
    padding: .58rem 0;
    border-top: 1px solid var(--tbrd-border);
}

.tbrd-detail-list dt {
    font-weight: 750;
}

.tbrd-detail-list dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.tbrd-detail-error {
    padding: 1rem;
    border-left: 4px solid #a52828;
    background: #fff1f1;
}

@media (max-width: 900px) {
    .tbrd-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tbrd-field-search {
        grid-column: span 2;
    }

    .tbrd-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .tbrd-toolbar-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 680px) {
    .tbrd-filters {
        grid-template-columns: 1fr;
    }

    .tbrd-field-search {
        grid-column: span 1;
    }

    .tbrd-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .tbrd-toolbar-actions {
        width: 100%;
        flex-direction: column;
    }

    .tbrd-toolbar-actions button {
        width: 100%;
    }

    .tbrd-table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .tbrd-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .tbrd-table,
    .tbrd-table tbody,
    .tbrd-table tr,
    .tbrd-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .tbrd-table tr {
        margin-bottom: .85rem;
        padding: .65rem .8rem;
        border: 1px solid var(--tbrd-border);
        border-radius: .55rem;
        background: #fff;
    }

    .tbrd-table td {
        display: grid;
        grid-template-columns: minmax(7.5rem, .8fr) minmax(0, 1.4fr);
        gap: .65rem;
        padding: .5rem 0;
        border-bottom: 1px solid var(--tbrd-border);
    }

    .tbrd-table td:last-child {
        border-bottom: 0;
    }

    .tbrd-table td::before {
        content: attr(data-label);
        font-weight: 750;
    }

    .tbrd-detail-grid {
        grid-template-columns: 1fr;
    }


    .tbrd-detail-list > div {
        grid-template-columns: 1fr;
        gap: .15rem;
    }
}

.tbrd-detail-map-block {
    margin-top: 0;
}

.tbrd-detail-map {
    width: 100%;
    height: 300px;
    overflow: hidden;
    border: 1px solid var(--tbrd-border);
    border-radius: .55rem;
    background: var(--tbrd-surface-strong);
    font: inherit;
}

.tbrd-detail-map-unavailable {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: 1rem;
    color: var(--tbrd-muted);
    text-align: center;
}

.tbrd-detail-map-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: .7rem;
}

.tbrd-detail-map-actions .tbrd-detail-button,
.tbrd-detail-map-fallback .tbrd-detail-button {
    min-height: 2.35rem;
    padding: .45rem .7rem;
    font-size: .92rem;
}

.tbrd-detail-map-fallback {
    margin-top: 1rem;
}

.tbrd-detail-map .leaflet-control-attribution {
    font-size: 10px;
}

@media (max-width: 680px) {
    .tbrd-detail-map {
        height: 220px;
    }

    .tbrd-detail-map-actions {
        flex-direction: column;
    }

    .tbrd-detail-map-actions .tbrd-detail-button,
    .tbrd-detail-map-fallback .tbrd-detail-button {
        width: 100%;
        text-align: center;
    }
}


/* Keep primary library website button text white after visiting. */
a.tbrd-detail-button:not(.tbrd-detail-button-secondary):visited {
    color: #fff !important;
}

/* Ensure white secondary buttons always have visible blue text. */
.tbrd-directory button.tbrd-button-secondary {
    color: #075da8 !important;
    -webkit-text-fill-color: #075da8 !important;
}

.tbrd-directory button.tbrd-button-secondary:hover {
    color: #064a85 !important;
    -webkit-text-fill-color: #064a85 !important;
}
