/* Resource-only finishing, using the approved settings/messages interaction palette. */
/* Keep desktop tags in the sidebar; mobile tags follow the complete description. */
.res-detail-mobile-tags { display: none; }
@media (max-width: 700px) {
    .res-detail-aside > .res-tag-list { display: none; }
    .res-detail-mobile-tags { display: block; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--res-border); }
    .res-detail-mobile-tags h2 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
    .res-detail-mobile-tags .res-tag-list { margin-top: 0; }
    .res-detail-mobile-tags .res-tag-list a { max-width: 100%; overflow-wrap: anywhere; }
    .res-tags-disclosure { margin-top: 8px; }
    .res-tags-disclosure > summary { display: flex; align-items: center; gap: 6px; width: fit-content; min-height: 44px; padding: 4px 0; color: var(--res-muted); font-size: 12px; cursor: pointer; list-style: none; }
    .res-tags-disclosure > summary::-webkit-details-marker { display: none; }
    .res-tags-disclosure > summary:hover { color: var(--res-text); }
    .res-tags-disclosure > summary:focus-visible { outline: 2px solid var(--res-accent); outline-offset: 3px; border-radius: 4px; }
    .res-tags-disclosure > summary svg { width: 16px; height: 16px; }
    .res-tags-disclosure .res-tags-less, .res-tags-disclosure[open] .res-tags-more { display: none; }
    .res-tags-disclosure[open] .res-tags-less { display: inline; }
    .res-tags-disclosure[open] > summary svg { transform: rotate(180deg); }
}
.res-ui.res-detail > .res-detail-footer { margin-top: 24px; padding-top: 8px; border-top: 1px solid var(--res-border); }
@media (max-width: 700px) {
    body.resources-page main:has(> .res-page[data-res-library-view]) { padding-top: 8px; }
    body.resources-page .res-page[data-res-library-view] { padding-top: 0; }
    .res-page[data-res-library-view] > .res-back-link { display: inline-flex; align-items: center; min-height: 28px; margin-bottom: 2px; }
    body.resources-page main:has(> .res-detail) { padding-top: 8px; }
    body.resources-page .res-ui.res-detail { padding-top: 0; }
    .res-ui.res-detail .res-detail-navigation { margin-bottom: 2px; }
    .res-ui.res-detail .res-detail-navigation .res-back-link,
    .res-ui.res-detail .res-detail-mobile-categories a { min-height: 28px; }
    .res-ui.res-detail .res-detail-aside h1 { margin-top: 4px; }
}
.res-detail-navigation { display: contents; }
.res-detail-mobile-categories { display: none; }
.res-stat-value { display: contents; }
.res-stat-value svg { order: -1; }
@media (min-width: 701px) { .res-detail-navigation .res-back-link { font-size: 13px; } }
@media (max-width: 700px) {
    .res-detail .res-detail-navigation { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
    .res-detail .res-detail-navigation .res-back-link { flex-shrink: 0; margin: 0; font-size: 12px; }
    .res-detail .res-detail-mobile-categories { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 10px; min-width: 0; }
    .res-detail .res-detail-mobile-categories a { display: inline-flex; align-items: center; min-height: 32px; color: var(--res-muted); font-size: 11px; overflow-wrap: anywhere; text-align: right; }
    .res-detail .res-detail-aside > .res-card-tags { display: none; }
    .res-ui.res-detail .res-detail-meta { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; border-bottom: 0; padding-bottom: 4px; }
    .res-detail .res-detail-meta .res-source { order: -1; gap: 5px; }
    .res-detail .res-detail-meta .res-detail-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-height: 0; }
    .res-detail .res-stat-label { font-size: 11px; line-height: 1.5; color: var(--res-muted); }
    .res-detail .res-detail-meta .res-source small { line-height: 1.5; }
    .res-detail .res-stat-value { display: inline-flex; align-items: center; gap: 6px; min-height: 18px; font-size: 12px; line-height: 1.5; }
    .res-detail .res-stat-value svg { width: 14px; height: 14px; }
    .res-detail .res-detail-meta .res-source > span { font-size: 12px; line-height: 1.5; font-weight: 500; }
}
.res-detail .res-secondary-actions [data-res-share] { display: inline-flex; align-items: center; gap: 6px; }
.res-detail .res-secondary-actions .res-share-icon { width: 16px; height: 16px; flex-shrink: 0; pointer-events: none; }
@media (min-width: 701px) {
    .res-detail > .res-back-link { font-size: 13px; }
    .res-detail .res-detail-aside > .res-card-tags a { font-size: 12px; }
    .res-detail .res-detail-summary { font-size: 15px; }
    .res-detail .res-detail-aside > .res-pill { font-size: 12px; }
    .res-detail .res-detail-actions > :is(.res-button,.res-save-button) { font-size: 13px; }
    .res-detail .res-detail-stat, .res-detail .res-source { font-size: 13px; }
    .res-detail .res-source small { font-size: 12px; }
    .res-detail .res-secondary-actions .res-text-button { font-size: 13px; }
    .res-detail .res-tag-list a { font-size: 12px; }
    .res-detail .res-prose p { font-size: 14px; }
    .res-detail .res-prose small { font-size: 12px; }
}
/* Resource detail: compact mobile reading hierarchy, without changing the shared header. */
.res-detail-meta { display: contents; }
@media (max-width: 700px) {
    .res-ui.res-detail { padding-top: 8px; }
    .res-detail .res-back-link { display: inline-flex; align-items: center; min-height: 32px; margin-bottom: 12px; }
    .res-detail .res-detail-layout { gap: 20px; }
    .res-detail .res-detail-aside { min-width: 0; padding-top: 0; }
    .res-detail .res-detail-aside h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.025em; margin: 8px 0 10px; text-wrap: balance; }
    .res-detail .res-detail-summary { font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
    .res-detail .res-detail-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 18px 0 14px; }
    .res-detail .res-detail-actions > :only-child { grid-column: 1 / -1; }
    .res-detail .res-detail-actions > :is(a,button) { min-width: 0; min-height: 42px; padding: 9px 10px; font-size: 12px; white-space: normal; line-height: 1.35; }
    .res-detail .res-detail-actions svg { flex-shrink: 0; }
    .res-detail .res-detail-meta { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: start; gap: 12px; padding: 12px 0; border-block: 1px solid var(--res-border); }
    .res-detail .res-detail-stat { min-width: 0; margin: 0; font-size: 12px; min-height: 36px; }
    .res-detail .res-source { min-width: 0; margin: 0; padding: 0; border: 0; gap: 3px; overflow-wrap: anywhere; }
    .res-detail .res-source small { font-size: 11px; }
    .res-detail .res-secondary-actions { gap: 8px 16px; margin-top: 10px; }
    .res-detail .res-secondary-actions .res-text-button { display: inline-flex; align-items: center; min-height: 32px; font-size: 12px; }
    .res-detail .res-detail-content { min-width: 0; }
    .res-detail .res-detail-image { margin-top: 0; border-radius: 14px; }
    .res-detail .res-detail-image > img { display: block; }
    .res-detail .res-prose { margin-top: 20px; }
    .res-detail .res-prose h2 { font-size: 15px; margin-bottom: 8px; }
    .res-detail .res-prose p { line-height: 1.7; }
    .res-detail .res-related { margin-top: 28px; }
}
@media (max-width: 370px) {
    .res-detail .res-detail-aside h1 { font-size: 22px; }
    .res-detail .res-detail-actions { grid-template-columns: minmax(0,1fr); }
}
/* Keep card actions usable through the one/two-column breakpoint. */
@media (max-width: 550px) {
    .res-ui .res-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}
@media (min-width: 551px) and (max-width: 760px) {
    .res-ui .res-grid .res-card-footer { flex-wrap: wrap; }
    .res-ui .res-grid .res-card-actions { margin-left: auto; }
}
.res-catalog.res-ui > .res-page-heading h1 { display: flex; align-items: center; gap: 9px; }
.res-catalog.res-ui .res-total-count { display: inline-flex; align-items: center; justify-content: center; min-width: 21px; height: 21px; margin: 0; padding: 0 6px; border: 1px solid var(--res-border); border-radius: 6px; background: var(--res-panel); color: var(--res-muted); font-size: 11px; font-weight: 600; line-height: 1; letter-spacing: normal; }
@media (max-width: 700px) {
    .res-profile-library > .res-page-heading > div:first-child { padding-inline: 12px; }
}
body.profile-page .res-profile-library .res-collection-cover {
    background: color-mix(in srgb, var(--res-profile-tone) 22%, var(--t-border));
}
body.profile-page .res-profile-library .res-collection-cover > .res-cover-empty {
    background: color-mix(in srgb, var(--res-profile-tone) 9%, var(--t-card));
    color: color-mix(in srgb, var(--res-profile-tone) 55%, var(--t-muted));
}
body.profile-page .res-profile-library .res-cover-empty svg { color: inherit; opacity: .85; }
@media (max-width: 600px) {
    body.resources-page .res-catalog.res-ui .res-searchbar { padding: 4px; }
    body.resources-page .res-catalog.res-ui .res-searchbar .res-search input { min-height: 38px; height: 38px; padding-top: 7px !important; padding-bottom: 7px !important; }
    body.resources-page .res-catalog.res-ui .res-search-submit { min-height: 38px; height: 38px; padding: 7px 14px; }
    body.resources-page .res-catalog.res-ui .res-filter-select :is(.res-select-trigger, select) { min-height: 36px; height: 36px; padding-top: 6px; padding-bottom: 6px; }
    body.resources-page .res-catalog.res-ui .res-category-pills a { min-height: 32px; padding: 4px 10px; }
}
/* Saved is a quiet persistent state, distinct from a primary action. */
html .res-card .res-save-button.is-saved {
    color: color-mix(in srgb, var(--res-accent) 38%, var(--res-text));
    background: color-mix(in srgb, var(--res-accent) 7%, var(--res-bg));
    border-color: color-mix(in srgb, var(--res-accent) 24%, var(--res-border));
}
html .res-card .res-save-button.is-saved:not(:disabled):hover {
    color: color-mix(in srgb, var(--res-accent) 25%, var(--res-text));
    background: color-mix(in srgb, var(--res-accent) 12%, var(--res-bg));
    border-color: color-mix(in srgb, var(--res-accent) 38%, var(--res-border));
}
.res-ui .res-button > .res-share-icon { width: 16px; height: 16px; flex-shrink: 0; pointer-events: none; }
/* Resource surfaces inherit the same cover accent as the other profile tabs. */
body.profile-page :is(.res-profile-library, .res-profile-library .res-card, .res-profile-library .res-collection-card, .res-dialog, .res-select-menu) {
    --res-profile-tone: var(--profile-thought-accent, rgb(var(--profile-header-accent,94,103,125)));
    --res-bg: color-mix(in srgb, var(--res-profile-tone) 3%, var(--t-input));
    --res-panel: color-mix(in srgb, var(--res-profile-tone) 6%, var(--t-card));
    --res-border: color-mix(in srgb, var(--res-profile-tone) 16%, var(--t-border));
    --res-text: var(--t-text);
    --res-muted: var(--t-muted);
    --res-accent: var(--res-profile-tone);
    --res-hover-bg: color-mix(in srgb, var(--res-profile-tone) 9%, var(--t-hover));
    --res-hover-border: color-mix(in srgb, var(--res-profile-tone) 39%, var(--t-border));
    --res-hover-text: color-mix(in srgb, var(--res-profile-tone) 24%, var(--t-text));
    --res-focus-border: color-mix(in srgb, var(--res-profile-tone) 57%, var(--t-border));
    --res-focus-ring: color-mix(in srgb, var(--res-profile-tone) 45%, transparent);
}
body.profile-page .res-select-menu { background: var(--res-bg); border-color: var(--res-border); }
body.profile-page .res-select-menu .res-select-option[aria-selected="true"] { background: var(--res-hover-bg); color: var(--res-hover-text); }
body.profile-page :is(.res-profile-library, .res-dialog) .res-primary:hover {
    background: color-mix(in srgb, var(--res-profile-tone) 85%, #182335);
    border-color: var(--res-focus-border);
}
body.profile-page .res-dialog .res-choice:has(input:checked) { background: var(--res-hover-bg); }
body.profile-page .res-profile-library .res-price:hover { background: var(--res-hover-bg); }
@media (max-width: 600px) {
    body.resources-page main { padding-inline: 8px !important; }
    body.resources-page main > .res-page { width: 100%; padding-inline: 0; }
}
.res-dialog .res-folder-choice input[type="checkbox"] {
    appearance: none; -webkit-appearance: none; display: grid; place-content: center;
    width: 15px; height: 15px; margin: 0; flex-shrink: 0; cursor: pointer;
    border: 1px solid var(--res-border); border-radius: 4px; background: var(--res-panel);
}
.res-dialog .res-folder-choice input[type="checkbox"]::before {
    content: ""; width: 7px; height: 4px; border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff;
    transform: translateY(-1px) rotate(-45deg); visibility: hidden;
}
.res-dialog .res-folder-choice input[type="checkbox"]:checked { background: var(--res-accent); border-color: var(--res-accent); }
.res-dialog .res-folder-choice input[type="checkbox"]:checked::before { visibility: visible; }
.res-dialog .res-folder-choice input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
@media (forced-colors: active) { .res-dialog .res-folder-choice input[type="checkbox"] { appearance: auto; } .res-dialog .res-folder-choice input[type="checkbox"]::before { content: none; } }
.res-profile-library > .res-page-heading h2 { display: flex; align-items: center; gap: 9px; }
.res-profile-library > .res-page-heading h2 small {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    min-width: 21px; height: 21px; margin: 0; padding: 0 6px;
    border: 1px solid var(--res-border); border-radius: 6px;
    background: var(--res-panel); color: var(--res-muted);
    font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
}
.res-ui .res-empty h2 { font-size: 14px; }
.res-collection-card .res-collection-meta { font-size: 12px; }
.res-collection-card .res-collection-copy p { font-size: 12px; }
.res-collection-tools .res-text-button { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.res-collection-tools .res-text-button svg { width: 14px; height: 14px; flex-shrink: 0; }
.res-collection-tools .res-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; min-height: 28px; padding: 0; border-radius: 8px; }
.res-collection-tools .res-icon-button svg { display: block; width: 14px; height: 14px; flex-shrink: 0; }
.res-collection-tools svg { pointer-events: none; }
/* Mobile resources use the notifications header geometry and scroll states. */
.res-topbar-heading, .res-topbar-heading-inner, .res-topbar-toolbar { display: contents; }
.res-topbar-heading .mobile-header-logo { display: none; }
@media (min-width: 601px) and (max-width: 700px) { .res-topbar .res-wordmark { display: block; } }
@media (max-width: 600px) {
    body.resources-page > div:has(> div > header .res-topbar) { padding-top: 0 !important; }
    body.resources-page header:has(.res-topbar) {
        display: block; position: relative; flex: none; min-height: 0;
        padding: 0 !important; gap: 0; background: var(--t-surface) !important;
        backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); transition: none;
    }
    body.resources-page .res-topbar.res-ui { display: block; position: relative; min-height: 0; width: 100%; padding: 0; margin: 0; font-size: 16px; line-height: 24px; }
    body.resources-page .res-topbar .res-topbar-heading {
        display: flex; position: relative; align-items: center; justify-content: center;
        height: auto; min-height: 0; max-height: 86px; padding: 9px 12px 7px; margin: 0; gap: 10px;
        overflow: hidden; opacity: 1; transform: translateY(0);
        transition: max-height .42s cubic-bezier(.22,1,.36,1), padding-top .42s cubic-bezier(.22,1,.36,1), padding-bottom .42s cubic-bezier(.22,1,.36,1), opacity .26s ease, transform .42s cubic-bezier(.22,1,.36,1);
    }
    body.resources-page .res-topbar-heading-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; gap: 5px; text-align: center; }
    body.resources-page .res-topbar .mobile-header-logo {
        position: static; inset: auto; display: flex; align-items: center; justify-content: center;
        flex: 0 0 auto; width: 32px; height: 32px; margin: 0 auto; border-radius: 10px;
        color: var(--ac); opacity: 1; transform: translateY(0);
        transition: opacity .26s ease, transform .42s cubic-bezier(.22,1,.36,1);
    }
    body.resources-page .res-topbar .mobile-header-logo svg { width: 23px; height: 23px; }
    body.resources-page .res-topbar .res-wordmark {
        display: block; width: 100%; margin: 0; font-size: 16px; font-weight: 600;
        line-height: 1.2; letter-spacing: -.025em; color: var(--t-text);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 1; transform: translateY(0);
        transition: opacity .26s ease, transform .42s cubic-bezier(.22,1,.36,1);
    }
    body.resources-page .res-topbar .res-topbar-toolbar {
        display: grid; grid-template-columns: minmax(0,1fr) 38px; align-items: center; justify-content: space-between;
        min-width: 0; height: auto; gap: 8px; margin: 0; padding: 8px;
        transition: padding-top .36s cubic-bezier(.22,1,.36,1), padding-bottom .36s cubic-bezier(.22,1,.36,1);
    }
    body.resources-page .res-topbar .res-topbar-toolbar:not(:has(.res-library-shortcut)) { grid-template-columns: minmax(0,1fr); gap: 0; }
    body.resources-page .res-topbar.res-ui nav { display: flex; align-items: center; width: 100%; min-width: 0; height: 38px; min-height: 38px; padding: 3px 2px; margin: 0; gap: 2px; border: 1px solid #202638; border-radius: 12px; background: #10131c; }
    body.resources-page .res-topbar.res-ui nav a { display: flex; align-items: center; justify-content: center; flex: 1 1 0; height: 32px; min-height: 32px; padding: 0 3px; margin: 0; font-size: 11.5px; font-weight: 600; line-height: 1; letter-spacing: -.015em; border-radius: 9px; color: #8e9ab3; background: transparent; transition: background .18s ease, color .18s ease; }
    body.resources-page .res-topbar.res-ui nav a:hover { color: #eef3fd; background: #131827; }
    body.resources-page .res-topbar.res-ui nav a.is-active { color: #8fa9d0; background: linear-gradient(180deg,#1a2642,#172036); box-shadow: inset 0 0 0 1px #29437a; }
    body.resources-page .res-topbar.res-ui .res-library-shortcut { display: grid; place-items: center; width: 38px; height: 38px; min-height: 38px; margin: 0; padding: 0; border: 1px solid var(--t-border); border-radius: 11px; color: var(--t-muted); background: transparent; }
    body.resources-page .res-topbar .res-library-shortcut span { display: none; }
    body.resources-page .res-topbar .res-library-shortcut svg { width: 18px; height: 18px; }
    body.resources-page header.mobile-logo-hidden .res-topbar-heading { height: auto; min-height: 0; max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; transform: translateY(-8px); pointer-events: none; }
    body.resources-page header.mobile-logo-hidden .res-topbar :is(.mobile-header-logo,.res-wordmark) { opacity: 0; transform: translateY(-8px); }
    body.resources-page header.mobile-logo-hidden .res-topbar-toolbar { padding: 8px; }
    html[data-theme="light"] body.resources-page .res-topbar nav { background: #fbfdff; border-color: #dde6f5; }
    html[data-theme="light"] body.resources-page .res-topbar nav a { color: #73809b; }
    html[data-theme="light"] body.resources-page .res-topbar nav a:hover { color: #2a3852; background: #f0f5fd; }
    html[data-theme="light"] body.resources-page .res-topbar nav a.is-active { color: #2a3852; background: #e5edfa; box-shadow: inset 0 0 0 1px #c9d8ef; }
    .res-catalog > .res-page-heading h1 { display: block; font-size: 20px; font-weight: 600; line-height: 1.25; letter-spacing: -.025em; margin: 0 0 6px; }
    .res-catalog > .res-page-heading p { font-size: 13px; line-height: 1.5; margin: 0; }
    .res-catalog > .res-page-heading { margin-bottom: 20px; }
}
/* Keep shell header motion consistent with notifications; resource content
   reduced-motion rules below must not override the shared header behavior. */
.res-ui, .res-card, .res-dialog, .res-collection-card {
    --res-hover-bg: var(--t-hover, #171c29);
    --res-hover-border: color-mix(in srgb, var(--ac, #4b83f5) 32%, var(--t-border, #252c3d));
    --res-hover-text: color-mix(in srgb, var(--ac-l, #93c5fd) 76%, var(--t-muted, #8994ac));
    --res-focus-border: color-mix(in srgb, var(--ac, #4b83f5) 55%, var(--t-border, #252c3d));
    --res-focus-ring: color-mix(in srgb, var(--ac, #4b83f5) 45%, transparent);
}
html[data-theme="light"] :is(.res-ui, .res-card, .res-dialog, .res-collection-card) {
    --res-hover-bg: #eef5fd;
    --res-hover-border: #b9cee6;
    --res-hover-text: #28558f;
    --res-focus-border: #6f9fe0;
}

/* Stable geometry: borders react, cards and images do not jump or zoom. */
.res-card-media { position: relative; }
.res-card .res-price {
    --price-bg: #25233b; --price-text: #c8bdf3; --price-border: #484161;
    text-decoration: none; cursor: pointer; font-weight: 600;
    background: var(--price-bg); color: var(--price-text); border-color: var(--price-border);
    box-shadow: 0 2px 6px #00000014;
    transition: filter .16s ease, border-color .16s ease;
}
.res-card .res-price.is-free { --price-bg: #19362e; --price-text: #9bd9ba; --price-border: #36584a; }
.res-card .res-price[href*="pricing=paid"] { --price-bg: #3a2d1e; --price-text: #edcb92; --price-border: #5e4930; }
html[data-theme=light] .res-card .res-price { --price-bg: #f0ebfa; --price-text: #65508d; --price-border: #d9cee9; }
html[data-theme=light] .res-card .res-price.is-free { --price-bg: #e8f4ed; --price-text: #286847; --price-border: #c5dfcf; }
html[data-theme=light] .res-card .res-price[href*="pricing=paid"] { --price-bg: #faf0df; --price-text: #805a23; --price-border: #e8d4b1; }
.res-card .res-price:hover, .res-card .res-price:focus-visible,
body.profile-page .res-profile-library .res-price:hover {
    background: var(--price-bg); color: var(--price-text); border-color: var(--price-text);
}
.res-card .res-price:focus-visible { outline: 2px solid var(--price-text); outline-offset: 2px; }
.res-card .res-price:active { filter: brightness(.95); }
@media (prefers-reduced-motion: reduce) { .res-card .res-price { transition: none; } }
.res-card, .res-collection-card { transition: border-color .18s ease, box-shadow .18s ease; }
.res-card:focus-within, .res-collection-card:focus-within { border-color: var(--res-focus-border); }
.res-card h3 a, .res-card-tags a, .res-collection-copy h3 a,
.res-ui .res-text-button, .res-ui .res-back-link, .res-ui .res-collection-by a,
.res-ui .res-topbar nav a, .res-topbar.res-ui nav a, .res-ui .res-library-shortcut {
    transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}
.res-topbar.res-ui nav a { color: var(--res-muted); }
.res-topbar.res-ui nav a.is-active { color: var(--res-text); }
.res-topbar.res-ui .res-library-shortcut { min-height: 34px; padding: 6px 8px; border-radius: 9px; }
.res-ui .res-text-button, .res-ui .res-back-link { text-underline-offset: 3px; }
.res-ui .res-heading-actions .res-button, .res-dialog .res-button,
.res-ui .res-button, .res-card .res-save-button, .res-card .res-icon-button {
    transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.res-ui .res-primary, .res-dialog .res-primary { filter: none; }
.res-ui .res-page-heading { margin-bottom: 20px; }
.res-ui .res-empty { padding: 38px 20px; }
.res-ui .res-empty > svg { margin-bottom: 14px; }
.res-ui .res-empty p { margin-bottom: 17px; }
.res-ui .res-pagination:empty { display: none; }
.res-ui .res-editorial > .res-section-heading { margin-top: 24px; }

/* Catalog rhythm: one compact search row, then filters and results. */
.res-catalog.res-ui .res-searchbar { padding: 5px; border-radius: 13px; border-color: var(--res-border); transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease; }
.res-catalog.res-ui .res-searchbar .res-search input { min-height: 42px; padding-top: 9px !important; padding-bottom: 9px !important; }
.res-catalog.res-ui .res-search-submit { min-height: 42px; padding: 9px 17px; gap: 12px; }
.res-catalog.res-ui .res-searchbar:focus-within { border-color: var(--res-focus-border); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ac) 9%, transparent); }
.res-catalog.res-ui .res-filter-toolbar { padding: 8px 2px 10px; }
.res-catalog.res-ui .res-category-pills { padding-bottom: 18px; }
.res-catalog.res-ui .res-catalog-results { margin: 16px 0 14px; }
.res-catalog.res-ui .res-catalog-results .res-select-wrap select { background: var(--res-panel); border-color: var(--res-border); }
.res-catalog.res-ui .res-filter-reset { transition: color .16s ease, background-color .16s ease; }
.res-catalog.res-ui .res-category-pills a.is-active { color: var(--res-hover-text); }

/* Keyboard interaction remains visible independently of hover. */
html .res-ui :is(a, button):focus-visible,
html .res-card :is(a, button):focus-visible,
html .res-dialog :is(a, button, input, textarea, select, summary):focus-visible {
    outline: 2px solid var(--res-focus-ring);
    outline-offset: 3px;
}
html[data-theme] .res-ui :is(.res-library-filters input, .res-library-filters select):focus-visible,
html[data-theme] .res-dialog :is(input, textarea, select):focus-visible,
html[data-theme] .res-catalog.res-ui .res-select-wrap select:focus-visible {
    border-color: var(--res-focus-border) !important;
}
.res-dialog .res-choice, .res-dialog .res-folder-choice, .res-dialog .res-new-inline,
.res-dialog .res-dialog-head button { transition: background-color .16s ease, color .16s ease, border-color .16s ease; }
.res-dialog .res-dialog-head button { display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 8px; }
.res-dialog .res-dialog-head button > svg { width: 16px; height: 16px; pointer-events: none; }
.res-dialog .res-choice:has(input:checked) { border-color: var(--res-focus-border); background: color-mix(in srgb, var(--ac) 7%, var(--res-panel)); }
.res-dialog .res-folder-choice:has(input:checked) { border-color: var(--res-focus-border); }
html .res-dialog :is(input:not([type="radio"]):not([type="checkbox"]), textarea, select):focus-visible {
    outline: none; box-shadow: none; border-color: var(--res-focus-border);
}
.res-dialog .res-choice input[type="radio"] {
    appearance: none; -webkit-appearance: none; width: 15px; height: 15px; margin: 0;
    border: 1px solid var(--res-muted); border-radius: 50%; background: var(--res-bg);
    display: grid; place-content: center; cursor: pointer;
}
.res-dialog .res-choice input[type="radio"]::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--res-accent); transform: scale(0);
}
.res-dialog .res-choice input[type="radio"]:checked { border-color: var(--res-accent); }
.res-dialog .res-choice input[type="radio"]:checked::before { transform: scale(1); }
@media (forced-colors: active) { .res-dialog .res-choice input[type="radio"] { appearance: auto; } .res-dialog .res-choice input[type="radio"]::before { content: none; } }

@media (hover: hover) and (pointer: fine) {
    .res-card:hover, .res-collection-card:hover { border-color: var(--res-hover-border); }
    html .res-card h3 a:hover, html .res-card-tags a:hover,
    html .res-ui .res-collection-copy h3 a:hover, html .res-ui .res-collection-by a:hover,
    html .res-ui .res-text-button:hover, html .res-ui .res-back-link:hover,
    html .res-ui .res-tag-list a:hover { color: var(--res-hover-text); }
    html .res-ui .res-tag-list a:hover { border-color: var(--res-hover-border); background: var(--res-hover-bg); }
    html .res-topbar.res-ui nav a:hover, html .res-topbar.res-ui .res-library-shortcut:hover {
        color: var(--res-hover-text); background: var(--res-hover-bg);
    }
    html .res-ui .res-button:not(.res-primary):not(:disabled):hover,
    html .res-dialog .res-button:not(.res-primary):not(:disabled):hover,
    html .res-card .res-icon-button:hover,
    html .res-ui .res-save-button:not(:disabled):hover,
    html .res-card .res-save-button:not(:disabled):hover {
        color: var(--res-hover-text); background: var(--res-hover-bg); border-color: var(--res-hover-border);
    }
    html .res-ui .res-primary:not(:disabled):hover, html .res-dialog .res-primary:not(:disabled):hover {
        background: color-mix(in srgb, var(--res-accent) 82%, #152035); border-color: color-mix(in srgb, var(--res-accent) 82%, #152035); color: #fff; filter: none;
    }
    html .res-ui .res-save-button.is-saved:not(:disabled):hover,
    html .res-card .res-save-button.is-saved:not(:disabled):hover {
        color: var(--res-text); background: color-mix(in srgb, var(--res-accent) 22%, var(--res-bg)); border-color: color-mix(in srgb, var(--res-accent) 60%, var(--res-border));
    }
    .res-catalog.res-ui .res-searchbar:hover:not(:focus-within) { border-color: var(--res-hover-border); }
    html .res-catalog.res-ui .res-category-pills a:hover {
        color: var(--res-hover-text); background: var(--res-hover-bg); border-color: var(--res-hover-border);
    }
    html .res-catalog.res-ui .res-category-pills a.is-active:hover {
        background: color-mix(in srgb, var(--ac) 13%, var(--res-bg)); border-color: var(--res-focus-border);
    }
    html .res-catalog.res-ui .res-filter-reset:hover { color: var(--res-hover-text); background: var(--res-hover-bg); }
    html[data-theme] .res-catalog.res-ui .res-select-wrap select:hover,
    html[data-theme] .res-ui :is(.res-library-filters input, .res-library-filters select):hover,
    html[data-theme] .res-dialog :is(input:not([type="checkbox"]):not([type="radio"]), textarea, select):hover {
        background: var(--res-hover-bg) !important; border-color: var(--res-hover-border) !important;
    }
    html .res-dialog .res-dialog-head button:hover { background: var(--res-hover-bg); color: var(--res-hover-text); }
    html .res-dialog .res-choice:has(input:not(:disabled)):hover,
    html .res-dialog .res-folder-choice:has(input:not(:disabled)):hover,
    html .res-dialog .res-new-inline:hover { border-color: var(--res-hover-border); background: var(--res-hover-bg); }
    html .res-dialog .res-new-inline summary:hover { color: var(--res-hover-text); }
    html .res-dialog .res-danger:hover { color: #e7818c; text-decoration: underline; text-underline-offset: 3px; }
}
@media (max-width: 760px) {
    .res-catalog.res-ui .res-filter-toolbar { padding-top: 10px; padding-bottom: 12px; }
    .res-catalog.res-ui .res-category-pills { padding-bottom: 15px; }
    .res-ui .res-page-heading { margin-bottom: 18px; }
}
@media (max-width: 480px) {
    .res-catalog.res-ui .res-searchbar .res-search input { min-height: 44px; }
    .res-catalog.res-ui .res-search-submit { min-height: 44px; padding: 9px 14px; }
    .res-ui .res-empty { padding: 30px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .res-card, .res-collection-card, .res-card *, .res-ui:not(.res-topbar) *, .res-dialog * { transition: none !important; }
}
