/* --- Starlight Library theme (tokens + base) --- */
:root {
    --sl-ink: #152032;
    --sl-ink-soft: #334155;
    --sl-muted: #64748b;
    --sl-link: #4338ca;
    --sl-link-hover: #3730a3;
    --sl-primary: #312e81;
    --sl-primary-hover: #1e1b4b;
    --sl-header: #121a2d;
    --sl-header-glow: rgba(139, 159, 245, 0.45);
    --sl-accent-soft: #c7d2fe;
    --sl-amber: #d4a017;
    --sl-success: #15803d;
    --sl-danger: #b91c1c;
    --sl-surface: #ffffff;
    --sl-surface-soft: #eef2ff;
    --sl-surface-strong: #dbe4ff;
    --sl-radius: 14px;
    --sl-radius-sm: 10px;
    --sl-shadow: 0 4px 28px rgba(15, 23, 42, 0.08);
    --sl-shadow-hover: 0 10px 36px rgba(15, 23, 42, 0.12);
    --sl-font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --sl-font-body: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --sl-metal-brass: #b88944;
    --sl-metal-brass-dark: #7a5226;
    --sl-metal-copper: #a95f3a;
    --sl-iron: #3f3328;

    /* Shared with body + top app bar (Milky Way + tint layers) */
    --sl-backdrop-color: #0b1020;
    --sl-backdrop-layers:
        radial-gradient(1000px 700px at 12% -10%, rgba(139, 159, 245, 0.2), transparent 55%),
        radial-gradient(800px 500px at 92% 15%, rgba(251, 191, 36, 0.08), transparent 45%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.28) 0%, rgba(226, 232, 252, 0.34) 45%, rgba(200, 210, 235, 0.34) 100%),
        url('/background-milky-way.jpg');
}

/* --- Base: readable text, no invisible copy --- */
html {
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

html, body {
    margin: 0;
    min-height: 100%;
}

/* Full-page backdrop: NASA Milky Way illustration (public domain) — commons.wikimedia.org/wiki/File:Milky_Way_galaxy.jpg
   The backdrop is rendered by a fixed-position pseudo-element below so the browser
   composites it as a single GPU layer; using background-attachment: fixed on body
   forces a full repaint of every backdrop layer on each scroll frame and stutters. */
body {
    position: relative;
    font-family: var(--sl-font-body);
    font-size: 16px;
    line-height: 1.55;
    color: var(--sl-ink);
    background-color: var(--sl-backdrop-color);
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: var(--sl-backdrop-layers);
    background-size: auto, auto, auto, cover;
    background-position: center, center, center, center;
    background-repeat: no-repeat;
    pointer-events: none;
    /* Force a dedicated GPU compositing layer so mobile browsers (iOS Safari in
       particular) don't repaint the backdrop on momentum scroll. */
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

.hero-banner {
    padding: 2rem;
    border-radius: var(--sl-radius);
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(238, 242, 255, 0.92) 55%, rgba(224, 231, 255, 0.55) 100%);
    border: 1px solid rgba(67, 56, 202, 0.08);
    box-shadow: var(--sl-shadow);
}

.hero-content h1 {
    margin: 0 0 0.75rem 0;
    font-size: 2.15rem;
    font-family: var(--sl-font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--sl-primary-hover);
}

.hero-content p {
    margin: 0 0 1rem 0;
    max-width: 60ch;
}

/* --- Home --- */
.home-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.home-hero .hero-content h1 {
    font-size: clamp(2rem, 4.2vw, 2.85rem);
    line-height: 1.12;
}

.home-welcome-copy {
    margin: 0 0 1.15rem 0;
}

.home-welcome-copy p {
    margin: 0 0 1rem 0;
    max-width: 72ch;
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--sl-ink-soft);
}

.home-welcome-copy p:last-child {
    margin-bottom: 0;
}

.home-explore {
    padding: 1.35rem 1.4rem 1.5rem;
    border-radius: var(--sl-radius);
    background: var(--sl-surface);
    border: 1px solid rgba(67, 56, 202, 0.08);
}

.home-section-heading {
    margin: 0 0 1.1rem 0;
    font-size: 1.45rem;
    font-family: var(--sl-font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--sl-primary-hover);
}

.home-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

a.home-tile {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1.1rem 1.15rem;
    text-decoration: none;
    color: inherit;
    border-radius: var(--sl-radius-sm);
    border: 1px solid rgba(15, 23, 42, 0.07);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

a.home-tile:hover {
    box-shadow: var(--sl-shadow-hover);
    transform: translateY(-2px);
    border-color: rgba(67, 56, 202, 0.18);
}

.home-tile__label {
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--sl-primary-hover);
}

.home-tile__text {
    font-size: 0.92rem;
    line-height: 1.45;
}

.home-growth-margins {
    pointer-events: none;
}

.home-growth-counter {
    pointer-events: auto;
    position: fixed;
    top: 220px;
    width: 180px;
    z-index: 10;
    padding: 0.8rem 0.9rem 1rem;
    border-radius: 14px;
    background: linear-gradient(180deg, #151922 0%, #0f141c 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.home-growth-counter--left {
    left: max(16px, calc((100vw - 1100px) / 2 - 195px));
}

.home-growth-counter--right {
    right: max(16px, calc((100vw - 1100px) / 2 - 195px));
}

.home-growth-counter__icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 130px;
    margin-bottom: 0.35rem;
}

.home-growth-counter__icon-img {
    width: 100%;
    max-width: 130px;
    max-height: 130px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.home-growth-counter__label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #d6ddf0;
    margin-bottom: 0.55rem;
}

.home-growth-counter__flip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    height: 62px;
    padding: 0 0.8rem;
    border-radius: 8px;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #22170e;
    text-shadow: 0 1px 0 rgba(255, 236, 178, 0.35);
    background:
        linear-gradient(180deg, #d5a15b 0%, #8e572a 28%, #6f401e 52%, #5a3118 100%);
    border: 2px solid #4a2712;
    box-shadow:
        inset 0 2px 0 rgba(255, 230, 180, 0.45),
        inset 0 -6px 10px rgba(35, 18, 8, 0.55),
        0 2px 6px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.home-growth-counter__flip-value {
    position: relative;
    z-index: 3;
}

.home-growth-counter__flip::before {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 6px;
    border: 2px solid #70411f;
    background:
        linear-gradient(180deg, #f2d39b 0%, #b47a3f 48%, #8b562a 50%, #6e401f 100%);
    box-shadow: inset 0 1px 0 rgba(255, 238, 194, 0.45), inset 0 -4px 8px rgba(37, 20, 10, 0.5);
    z-index: 1;
}

.home-growth-counter__flip::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    top: 50%;
    height: 2px;
    background: rgba(74, 39, 18, 0.45);
    transform: translateY(-1px);
    z-index: 2;
}

@media (max-width: 1360px) {
    .home-growth-counter {
        position: static;
        width: min(100%, 260px);
    }

    .home-growth-margins {
        display: flex;
        gap: 0.8rem;
        flex-wrap: wrap;
    }
}

/* Ensure main content is never white-on-white or covered by fixed UI.
   No z-index here — setting one would create a stacking context that traps
   modal overlays beneath the app bar (z-index: 5). */
main.main-content {
    position: relative;
    padding: 1.25rem 1rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.history-back-bar {
    display: flex;
    justify-content: flex-start;
    margin: 0 0 0.65rem;
}

.history-back-btn {
    flex-shrink: 0;
}

main.main-content a:not(.mdc-button):not(.btn) {
    color: var(--sl-link);
    font-weight: 500;
}

main.main-content a:not(.mdc-button):not(.btn):hover {
    color: var(--sl-link-hover);
    text-decoration: underline;
}

.site-footer {
    margin: 0 auto 1.25rem;
    padding: 0.5rem 1rem 1.25rem;
    max-width: 1100px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.55);
}

.site-footer__logo {
    flex-shrink: 0;
    border-radius: 4px;
    opacity: 0.92;
}

.site-footer__name {
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--sl-ink-soft);
}

/* Allow many nav buttons to wrap instead of overlapping */
.library-app-bar .mdc-top-app-bar__row {
    flex-wrap: wrap;
    height: auto !important;
    min-height: var(--library-brand-logo);
    padding-top: 2px;
    padding-bottom: 2px;
}

.library-app-bar .mdc-top-app-bar__section {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 4px;
}

.library-app-bar .mdc-top-app-bar__section--align-end {
    justify-content: flex-end;
}

.library-app-bar .mdc-top-app-bar__section,
.library-app-bar .mdc-top-app-bar__title {
    background: transparent !important;
}

/* App bar: transparent so the body’s fixed Milky Way backdrop reads as one continuous field.
   MatBlazor’s base .mdc-top-app-bar is position:fixed; Fixed="false" only toggles a shadow class.
   Relative positioning keeps the ribbon in normal flow below the bar. */
.library-app-bar.mdc-top-app-bar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    /* Sit above the fixed Book Dragon counter (z-index 10) so the account
       dropdown menu opens in front of it. Stays well below modals (11000+). */
    z-index: 50;
    background: transparent !important;
    color: #f7ead6;
    box-shadow: none;
    border-bottom: 1px solid rgba(245, 216, 174, 0.24);
    /* Logo size cap: large on desktop, scales down on narrow viewports so the bar doesn’t grow wider than the screen */
    --library-brand-logo: min(96px, 26vw);
}

.library-app-bar .mdc-top-app-bar__title,
.library-app-bar .mdc-top-app-bar__title a {
    color: #f7ead6 !important;
    text-decoration: none;
}

.library-app-bar__title {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.library-app-bar .app-brand {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #f7ead6 !important;
    text-decoration: none !important;
}

.library-app-bar .app-brand__logo {
    width: var(--library-brand-logo);
    height: var(--library-brand-logo);
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 0;
    padding: 0;
    background: none;
    /* Black-on-transparent mark → white for contrast on the photo banner */
    filter: brightness(0) invert(1) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.65));
}

.library-app-bar .app-brand__name {
    font-size: clamp(1.2rem, 2.8vw, 1.65rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.15;
    color: #fff !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65), 0 0 18px rgba(0, 0, 0, 0.35);
}

/* MatBlazor buttons in header */
.library-app-bar .mdc-button,
a.nav-mdc-button {
    max-width: 100%;
    text-decoration: none;
}

a.nav-mdc-button.mdc-button--raised {
    vertical-align: middle;
}

.library-app-bar .mdc-button--outlined:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff !important;
}

.library-app-bar .mdc-button--raised:not(:disabled) {
    background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(67, 56, 202, 0.35);
}

.library-app-bar .mdc-button .mdc-button__label {
    color: inherit !important;
}

.library-header {
    position: relative;
    /* Above the fixed Book Dragon counter (z-index 10) so the account
       dropdown menu opens in front of it. Stays well below modals (11000+). */
    z-index: 50;
}

.library-nav-ribbon {
    width: 100%;
    background: linear-gradient(
        180deg,
        rgba(49, 46, 129, 0.94) 0%,
        rgba(30, 27, 75, 0.98) 55%,
        rgba(24, 21, 61, 1) 100%
    );
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    border-bottom: 1px solid rgba(0, 0, 0, 0.28);
    box-shadow:
        0 6px 24px rgba(15, 23, 42, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.library-nav-ribbon__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    padding: 0.5rem 1rem 0.6rem;
}

.library-nav-ribbon__tab--right {
    margin-left: auto;
}

a.library-nav-ribbon__tab {
    padding: 0.42rem 0.95rem;
    border-radius: 999px;
    text-decoration: none !important;
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

a.library-nav-ribbon__tab:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff !important;
}

a.library-nav-ribbon__tab.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.28);
}

.library-nav-ribbon__tab .ribbon-label-short {
    display: none;
}

.contact-page-shell {
    padding: 1rem 1.1rem 1.2rem;
    max-width: 760px;
}

.contact-message-box {
    min-height: 150px;
    resize: vertical;
}

.contact-actions {
    margin-top: 0.4rem;
}

.contact-role-images {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin: 0;
    flex-wrap: wrap;
}

.contact-role-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.contact-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin: 0.5rem 0 1rem;
    flex-wrap: wrap;
}

.contact-details {
    margin: 0;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-summary {
    list-style: none;
    cursor: pointer;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    background: transparent;
    font-weight: 500;
    user-select: none;
}

.user-dropdown-summary::-webkit-details-marker {
    display: none;
}

.user-dropdown-summary__initials {
    display: none;
}

.user-dropdown[open] .user-dropdown-summary {
    background: rgba(255, 255, 255, 0.1);
}

.user-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    min-width: 180px;
    background: #fff;
    color: #333;
    border-radius: 8px;
    border: 0;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 20;
}

.user-dropdown-menu a,
.user-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 0.6rem 0.8rem;
    text-align: left;
    color: var(--sl-ink);
    background: transparent;
    border: 0;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
}

.user-dropdown-menu a:hover,
.user-dropdown-menu button:hover {
    background: #eef2ff;
}

.cart-badge {
    margin-left: 0.4rem;
    display: inline-block;
    min-width: 1.25rem;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.25rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #d6a66a 0%, #9a6530 100%);
    color: #2b1c11;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 233, 198, 0.6);
}

.catalog-page {
    padding: 1.25rem 1.35rem 1.5rem;
    background: var(--sl-surface);
    border-radius: var(--sl-radius);
    border: 1px solid rgba(67, 56, 202, 0.08);
}

.catalog-page::before {
    content: none;
}

.catalog-page::after {
    content: none;
}

.catalog-page .catalog-page-title::after {
    content: none;
}

.catalog-page-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(67, 56, 202, 0.12);
    position: relative;
}

.catalog-page-header::after {
    content: none;
}

.catalog-page-title::before {
    content: none;
}

.catalog-page-body {
    display: grid;
    grid-template-columns: minmax(200px, 240px) 1fr;
    gap: 1.25rem 1.5rem;
    align-items: start;
}

@media (max-width: 800px) {
    .catalog-page-body {
        grid-template-columns: 1fr;
    }

    .catalog-filters {
        position: static;
    }
}

.catalog-filters {
    padding: 1rem 1.1rem 1.1rem;
    border-radius: var(--sl-radius-sm);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.95) 100%);
    border: 1px solid rgba(67, 56, 202, 0.14);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
    position: sticky;
    top: 1rem;
}

.catalog-filters-heading {
    margin: 0 0 0.85rem 0;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--sl-font-display);
    letter-spacing: 0.02em;
    color: var(--sl-primary-hover);
}

.catalog-filter-block {
    margin-bottom: 1rem;
}

.catalog-filter-apply {
    width: 100%;
    margin-top: 0.5rem;
}

.catalog-filter-checkbox {
    margin-bottom: 1rem;
}

.catalog-filter-check-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.92rem;
    line-height: 1.35;
    cursor: pointer;
    color: var(--sl-ink-soft);
}

.catalog-filter-check-label input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.catalog-filter-clear {
    width: 100%;
}

.catalog-results-column {
    min-width: 0;
}

.catalog-sort-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.65rem;
    margin-bottom: 0.65rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--sl-radius-sm);
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.catalog-sort-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--sl-ink-soft);
    white-space: nowrap;
}

.catalog-sort-bar select.catalog-sort-select {
    min-width: min(100%, 10rem);
    max-width: 12rem;
    width: auto;
    flex: 0 1 auto;
    margin-bottom: 0;
    padding: 0.22rem 0.4rem;
    font-size: 0.82rem;
    line-height: 1.25;
    min-height: 0;
}

.catalog-page-title {
    margin: 0 0 0.35rem 0;
    font-size: 1.75rem;
    font-weight: 600;
    font-family: var(--sl-font-display);
    letter-spacing: -0.02em;
    color: var(--sl-primary-hover);
}

.catalog-page-subtitle {
    margin: 0;
    max-width: 42ch;
}

.genres-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.85rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

a.genre-tile {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    text-decoration: none;
    color: inherit;
    border-radius: var(--sl-radius-sm);
    border: 1px solid rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

a.genre-tile:hover {
    box-shadow: var(--sl-shadow-hover);
    transform: translateY(-2px);
}

.genre-tile__name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--sl-primary-hover);
}

.genre-tile__desc {
    font-size: 0.9rem;
    line-height: 1.4;
}

.search-page-form {
    margin-bottom: 1.25rem;
}

.search-page-field {
    margin-bottom: 0;
}

.search-page-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.search-page-controls .form-control {
    flex: 1 1 220px;
    min-width: 0;
}

.search-results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.search-result {
    padding: 0.75rem 1rem;
    border-radius: var(--sl-radius-sm);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.search-result__link {
    font-weight: 600;
    display: block;
    margin-bottom: 0.2rem;
}

.catalog-loading {
    margin: 0;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.catalog-results-count {
    margin: 0 0 0.65rem;
    font-size: 0.85rem;
}

.catalog-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(67, 56, 202, 0.12);
}

.catalog-pagination__page {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.65rem;
    border-radius: var(--sl-radius-sm);
    border: 1px solid rgba(67, 56, 202, 0.25);
    background: var(--sl-surface);
    color: inherit;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.catalog-pagination__page:hover:not(.catalog-pagination__page--current) {
    background: rgba(67, 56, 202, 0.08);
    border-color: rgba(67, 56, 202, 0.45);
}

.catalog-pagination__page--current {
    background: rgba(67, 56, 202, 0.95);
    border-color: rgba(67, 56, 202, 0.95);
    color: #fff;
    cursor: default;
}

.catalog-pagination__ellipsis {
    padding: 0 0.25rem;
    color: var(--sl-muted, #6b7280);
    user-select: none;
}

.catalog-pagination__nav[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.catalog-card {
    border-radius: var(--sl-radius-sm);
    overflow: hidden;
    transition: box-shadow 0.22s ease, transform 0.22s ease;
    background: var(--sl-surface);
    border: 1px solid rgba(67, 56, 202, 0.12);
    display: flex;
    flex-direction: column;
}

.catalog-card:hover {
    box-shadow: var(--sl-shadow-hover);
    transform: translateY(-3px);
    border-color: rgba(67, 56, 202, 0.28);
}

.catalog-card::before,
.catalog-card::after {
    content: none;
}

.catalog-card .catalog-body::before {
    content: none;
}

.catalog-card-cover-link {
    display: block;
    text-decoration: none;
    color: inherit;
    outline: none;
}

.catalog-card-cover-link:focus-visible .catalog-image-wrap {
    outline: 2px solid var(--sl-link);
    outline-offset: 2px;
}

.catalog-card-title {
    margin: 0 0 0.35rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.catalog-card-title a {
    color: inherit;
    text-decoration: none;
}

.catalog-card-title a:hover {
    color: var(--sl-link);
    text-decoration: underline;
}

.catalog-author {
    margin: 0.15rem 0 0 0;
    font-size: 0.95rem;
}

.catalog-card-series {
    margin: 0.35rem 0 0.65rem 0;
    font-size: 0.78rem;
    line-height: 1.35;
    letter-spacing: 0.02em;
    font-weight: 500;
}

.catalog-image-wrap {
    aspect-ratio: 3 / 4;
    background: linear-gradient(145deg, #e8ecf5 0%, #dce3f0 100%);
    border-bottom: 1px solid rgba(67, 56, 202, 0.16);
}

.catalog-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.catalog-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--sl-muted);
    font-weight: 500;
}

.catalog-body {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.book-detail {
    position: relative;
    padding: 0;
    background: var(--sl-surface);
    border-radius: var(--sl-radius);
    border: 1px solid rgba(67, 56, 202, 0.12);
    overflow: hidden;
}

.book-detail-dragon-badge {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    padding: 0.35rem 0.55rem;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(241, 245, 255, 0.94) 100%);
    border: 1px solid rgba(67, 56, 202, 0.2);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
    line-height: 1.15;
}

.book-detail-dragon-badge__label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sl-muted);
}

.book-detail-dragon-badge__num {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: var(--sl-font-display);
    color: var(--sl-primary-hover);
}

.book-detail-hero {
    padding: 1.5rem 1.25rem 1.75rem;
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.75) 0%, rgba(255, 255, 255, 0.4) 100%);
    border-bottom: 1px solid rgba(67, 56, 202, 0.12);
}

.book-detail-hero-media {
    max-width: min(440px, 90vw);
    margin: 0 auto;
}

.book-detail-info {
    padding: 1.35rem 1.5rem 1.75rem;
    max-width: 46rem;
    margin: 0 auto;
}

.book-detail-cover-frame {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    aspect-ratio: 3 / 4;
    background: linear-gradient(145deg, #e8ecf5 0%, #dce3f0 100%);
    border-radius: var(--sl-radius-sm);
    overflow: hidden;
    box-shadow: 0 10px 36px rgba(15, 23, 42, 0.14);
    border: 1px solid rgba(67, 56, 202, 0.16);
}

.book-detail-cover-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    display: block;
}

.book-detail-placeholder {
    font-size: 1.15rem;
}

.book-detail-category {
    margin: 0 0 0.5rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sl-muted);
}

.book-detail-section-heading {
    margin: 1.35rem 0 0.5rem 0;
    font-size: 1.12rem;
    font-weight: 600;
    font-family: var(--sl-font-display);
    color: var(--sl-primary-hover);
    letter-spacing: -0.01em;
    position: relative;
    padding-bottom: 0.25rem;
}

.book-detail-section-heading::after {
    content: none;
}

.book-detail-section-heading::before {
    content: none;
}

.book-detail-info::before,
.book-detail-info::after {
    content: none;
}

.book-detail-info::after {
    margin: 0;
}

.book-detail-title {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    font-family: var(--sl-font-display);
    letter-spacing: -0.02em;
    color: var(--sl-primary-hover);
}

.book-detail-author {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--sl-ink-soft);
}

.book-detail-series {
    margin: 0 0 0.75rem 0;
}

.book-detail-goodreads {
    margin: 0 0 1rem 0;
}

.book-detail-cover-label {
    margin: 0 0 0.35rem 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.book-detail-cover-frame--back {
    margin-bottom: 0;
}

.book-detail-copies {
    margin: 1.25rem 0 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(67, 56, 202, 0.12);
}

.book-detail-copies-heading {
    margin-top: 0;
}

.book-detail-copy-list {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.book-detail-copy-list li {
    margin-bottom: 0.35rem;
}

.book-detail-copy-id {
    font-weight: 600;
    margin-right: 0.5rem;
}

.book-detail-copy-condition {
    margin-left: 0.5rem;
    font-weight: 500;
    color: var(--sl-ink-soft);
}

.book-detail-isbn {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
}

.book-detail-description {
    margin: 0 0 1.25rem 0;
    max-width: 65ch;
    line-height: 1.6;
    white-space: pre-line;
}

.book-detail-facts {
    margin: 0 0 1rem 0;
    padding-left: 1.25rem;
    max-width: 65ch;
}

.book-detail-section-heading + .book-detail-facts {
    margin-top: 0;
}

.book-detail-facts li {
    margin-bottom: 0.35rem;
}

.book-detail-availability {
    margin-bottom: 1rem;
}

.book-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 0.75rem;
    align-items: center;
}

.book-detail-actions > p {
    margin: 0;
    flex-basis: 100%;
}

.muted {
    color: var(--sl-muted);
    margin: 0;
}

.price-zar {
    margin: 0.5rem 0 0.25rem 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.availability {
    margin: 0 0 0.75rem 0;
    font-weight: 600;
}

.availability.available {
    color: var(--sl-success);
}

.availability.unavailable {
    color: var(--sl-danger);
}

.catalog-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 0.65rem;
}

.cart-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(280px, 560px) minmax(240px, 360px);
    gap: 1rem;
    align-items: start;
}

.auth-card {
    border-radius: var(--sl-radius);
    overflow: hidden;
    background: var(--sl-surface);
    border: 1px solid rgba(67, 56, 202, 0.08);
}

.auth-card-body {
    padding: 1rem 1.1rem;
}

.auth-subtitle {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
    font-weight: 600;
}

.alert {
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.9rem;
    border-radius: var(--sl-radius);
    border: 1px solid transparent;
    font-size: 0.95rem;
    line-height: 1.4;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffecb5;
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

.auth-separator {
    border: 0;
    border-top: 1px solid #dde5ea;
    margin: 0.9rem 0;
}

.auth-register-lead {
    margin: 0 0 1rem 0;
    font-size: 0.95rem;
    line-height: 1.45;
}

.auth-role-heading {
    margin: 1rem 0 0.35rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: var(--sl-font-display);
    color: var(--sl-primary-hover);
    letter-spacing: -0.01em;
}

.auth-role-heading:first-of-type {
    margin-top: 0.25rem;
}

.auth-role-copy {
    margin: 0 0 0.35rem 0;
    font-size: 0.9rem;
    line-height: 1.45;
}

.auth-register-cta {
    margin: 1rem 0 0.25rem 0;
}

@media (max-width: 900px) {
    .auth-grid {
        grid-template-columns: 1fr;
    }
}

/* Combined selector beats global .mdc-card so gradient + soft shadow apply */
.account-manage-shell.mdc-card {
    border-radius: var(--sl-radius);
    overflow: hidden;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92) 0%, rgba(255, 255, 255, 0.98) 38%, #fff 100%);
    border: 1px solid rgba(15, 23, 42, 0.055);
    box-shadow: 0 6px 28px rgba(15, 23, 42, 0.045), 0 1px 4px rgba(15, 23, 42, 0.035);
}

.account-manage-header {
    padding: 1.25rem 1.25rem 1rem;
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.55) 0%, rgba(248, 250, 252, 0.25) 100%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.account-manage-header h1 {
    margin: 0;
    font-size: clamp(1.35rem, 2.5vw, 1.6rem);
    font-weight: 600;
    font-family: var(--sl-font-display);
    letter-spacing: -0.02em;
    color: var(--sl-primary-hover);
}

.account-manage-header__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.profile-disabled-label {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(185, 28, 28, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(185, 28, 28, 0.35);
}

.manage-library-user-table .profile-disabled-label {
    margin-left: 0.35rem;
    vertical-align: middle;
}

.account-manage-page-title--with-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.account-manage-header p {
    margin: 0.35rem 0 0;
    color: var(--sl-muted);
}

/* Manage account: horizontal tab strip (underline active state, scroll on narrow viewports) */
.account-tabs {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    padding: 0 0.25rem;
    margin: 0 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.2) transparent;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.72);
}

.account-tabs::-webkit-scrollbar {
    height: 5px;
}

.account-tabs::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
}

.account-tab {
    flex: 0 0 auto;
    position: relative;
    margin: 0;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    margin-bottom: -1px;
    padding: 0.7rem 0.95rem;
    background: transparent;
    color: var(--sl-ink-soft);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.3;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.account-tab:hover {
    background: rgba(15, 23, 42, 0.04);
    color: var(--sl-ink);
    border-bottom-color: transparent;
}

.account-tab:focus-visible {
    outline: 2px solid var(--sl-link);
    outline-offset: -2px;
    border-radius: 6px 6px 0 0;
    z-index: 1;
}

.account-manage-page-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: var(--sl-font-display);
    color: var(--sl-primary-hover);
    letter-spacing: -0.02em;
}

.account-manage-2fa-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    max-width: 42rem;
}

.account-2fa-optional-lead {
    margin: 0 0 1rem 0;
    max-width: 40rem;
}

.account-change-password-lead {
    margin: 0 0 1rem 0;
    max-width: 40rem;
}

.account-manage-section-title {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    font-family: var(--sl-font-display);
    color: var(--sl-primary-hover);
    letter-spacing: -0.02em;
}

.account-manage-subsection-title {
    margin: 1.25rem 0 0.65rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--sl-ink);
}

.account-2fa-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.65rem;
    align-items: center;
}

.account-2fa-inline-form {
    display: inline;
}

.account-tab.active {
    color: var(--sl-primary);
    font-weight: 600;
    border-bottom-color: var(--sl-primary);
    background: rgba(99, 102, 241, 0.06);
    box-shadow: none;
}

.account-manage-content {
    padding: 1.25rem 1.25rem 1.5rem;
}

.account-rental-history-table-wrap {
    overflow-x: auto;
    margin-top: 0.35rem;
}

.account-rental-history-table {
    margin-bottom: 0;
    min-width: 42rem;
}

.account-rental-history-table th,
.account-rental-history-table td {
    vertical-align: middle;
}

.account-rental-history-pending {
    font-size: 0.875rem;
    color: var(--sl-muted);
}

.rental-history-expand-btn {
    display: block;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-align: left;
}

.account-rental-history-clickable-row {
    cursor: pointer;
}

.account-rental-history-overdue-detail td {
    background: #fff6f6;
}

.account-rental-history-alert {
    margin-bottom: 0.75rem;
}

@media (min-width: 640px) {
    .account-tabs {
        margin: 0 1rem;
        padding: 0 0.5rem;
    }
}

@media (min-width: 900px) {
    .account-tabs {
        margin: 0 1.25rem;
        padding: 0 0.75rem;
    }
}

/* Read-only fields on manage pages: calm “summary” look */
.account-manage-content .form-control[readonly] {
    background-color: rgba(248, 250, 252, 0.95);
    border-color: rgba(15, 23, 42, 0.08);
    color: var(--sl-ink);
    cursor: default;
}

.account-manage-content .form-text {
    color: var(--sl-muted);
    font-size: 0.8125rem;
}

/* Manage account forms: fixed-width label column, left-aligned */
.account-manage-content .account-field-row {
    display: grid;
    grid-template-columns: minmax(10.5rem, 13rem) minmax(0, 1fr);
    gap: 0.5rem 1.25rem;
    align-items: center;
    margin-bottom: 1rem;
}

.account-manage-content .account-field-row.account-field-row-stacked {
    align-items: start;
}

.account-manage-content .account-field-row.account-field-row-stacked .account-field-label {
    padding-top: 0.5rem;
}

.account-manage-content .account-field-label {
    margin: 0;
    text-align: left;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--sl-ink-soft);
    line-height: 1.35;
}

.account-manage-content .account-field-control {
    min-width: 0;
}

.account-manage-content .account-field-control .form-text {
    margin-top: 0.35rem;
}

.account-manage-content .account-field-control .text-danger {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
}

.account-manage-content .account-field-actions {
    margin-top: 0.25rem;
    margin-bottom: 0;
    align-items: center;
}

.account-manage-content .account-field-actions .btn {
    min-width: 7.5rem;
}

@media (max-width: 520px) {
    .account-manage-content .account-field-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .account-manage-content .account-field-row.account-field-row-stacked .account-field-label {
        padding-top: 0;
    }

    .account-manage-content .account-field-actions .account-field-label:empty {
        display: none;
    }

    .account-manage-content .account-field-actions .btn {
        width: 100%;
    }
}

/* Account → Contributions (flat, no card chrome) */
.account-contributions-flow {
    max-width: 56rem;
}

.account-contributions-lead {
    margin-bottom: 1rem;
}

.account-contributions-toolbar {
    margin-bottom: 1rem;
}

.account-contributions-success {
    margin: 0.5rem 0 0.75rem;
}

.account-contributions-offer-form {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.account-contributions-table-wrap {
    margin-top: 0.25rem;
}

.account-contributions-table {
    margin-bottom: 0;
    vertical-align: middle;
}

.account-contributions-table thead th {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--sl-muted);
    text-transform: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

.account-contributions-table tbody td {
    vertical-align: middle;
}

.account-contributions-cover-cell {
    width: 5.5rem;
}

.account-contributions-cover-thumb {
    display: block;
    width: 4.25rem;
    height: auto;
    max-height: 4.75rem;
    object-fit: cover;
    border-radius: var(--sl-radius-sm);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.account-contributions-cover-cell .catalog-image-placeholder {
    width: 4.25rem;
    min-height: 4.25rem;
    font-size: 0.65rem;
}

/* ── Membership (manage account) ── */
.account-membership-wrap {
    max-width: 42rem;
}

.account-membership-alert {
    margin-bottom: 1rem;
}

.account-membership-banner {
    padding: 0.95rem 1.1rem;
    border-radius: var(--sl-radius-sm);
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}

.account-membership-banner--none {
    background: rgba(241, 245, 249, 0.95);
    border-color: rgba(15, 23, 42, 0.08);
}

.account-membership-banner--active {
    background: rgba(220, 252, 231, 0.5);
    border-color: rgba(21, 128, 61, 0.22);
}

.account-membership-banner--expired {
    background: rgba(254, 243, 199, 0.55);
    border-color: rgba(180, 83, 9, 0.22);
}

.account-membership-banner-title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: var(--sl-font-display);
    color: var(--sl-ink);
    letter-spacing: -0.015em;
}

.account-membership-banner-text {
    margin: 0;
    color: var(--sl-ink-soft);
    font-size: 0.9375rem;
    line-height: 1.45;
}

.account-manage-content dl.account-membership-facts {
    margin: 0 0 1.25rem;
    display: grid;
    grid-template-columns: minmax(10.5rem, 13rem) 1fr;
    column-gap: 1.25rem;
    row-gap: 0.65rem;
    align-items: start;
}

.account-manage-content dl.account-membership-facts > dt.account-field-label {
    margin: 0;
    padding-top: 0.12rem;
}

.account-manage-content dl.account-membership-facts > dd.account-field-control {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--sl-ink);
}

.account-membership-fee-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--sl-muted);
}

.account-membership-note {
    font-size: 0.875rem;
    color: var(--sl-muted);
    line-height: 1.55;
    margin: 0 0 1.25rem;
    padding: 0.65rem 0.85rem;
    background: rgba(248, 250, 252, 0.8);
    border-radius: var(--sl-radius-sm);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.account-membership-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.account-membership-actions .account-membership-payfast-hint {
    flex-basis: 100%;
    margin: 0;
    max-width: 36rem;
}

@media (max-width: 520px) {
    .account-manage-content dl.account-membership-facts {
        grid-template-columns: 1fr;
    }

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

.manage-library-shell {
    border-radius: var(--sl-radius);
    overflow: hidden;
    background: var(--sl-surface);
    border: 1px solid rgba(67, 56, 202, 0.12);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
}

.manage-library-header {
    padding: 1.1rem 1.1rem 0.7rem;
    border-bottom: 1px solid rgba(67, 56, 202, 0.12);
    background: linear-gradient(180deg, rgba(241, 245, 255, 0.75) 0%, rgba(255, 255, 255, 0) 100%);
}

.manage-library-header h1 {
    margin: 0;
}

.manage-library-header h1::before {
    content: none;
}

.manage-library-header h1::after {
    content: none;
}

.manage-library-header p {
    margin: 0.35rem 0 0;
    color: var(--sl-muted);
}

.manage-library-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.6rem 1.1rem 0.8rem;
    border-bottom: 1px solid rgba(67, 56, 202, 0.1);
}

.manage-library-tab {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--sl-ink-soft);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    font-weight: 500;
    box-shadow: none;
}

.manage-library-tab.active {
    background: linear-gradient(180deg, var(--sl-primary) 0%, var(--sl-primary-hover) 100%);
    color: #fff;
    border-color: var(--sl-primary-hover);
}

.contributions-success {
    color: var(--sl-success);
    margin: 0 0 0.5rem 0;
}

.contributions-table-wrap {
    overflow-x: auto;
    margin-top: 0.5rem;
}

.manage-library-body {
    padding: 1rem 1.1rem 1.3rem;
    min-width: 0;
}

.manage-library-table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.manage-library-user-table .actions-right {
    white-space: normal;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
    align-items: center;
    vertical-align: top;
}

.manage-library-user-table .actions-right .btn + .btn {
    margin-left: 0;
}

.manage-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.manage-header-row h2 {
    margin: 0;
}

.manage-header-row h2::before {
    content: none;
}

.manage-library-tabs::before,
.manage-library-tabs::after {
    content: none;
}

.catalog-page,
.book-detail,
.manage-library-shell {
    box-shadow: var(--sl-shadow);
}

.catalog-page-title,
.book-detail-title,
.manage-library-header h1 {
    text-shadow: none;
}

.actions-right {
    text-align: right;
    white-space: nowrap;
}

.actions-right .btn + .btn {
    margin-left: 0.4rem;
}

.manage-library-body .table tbody tr:hover {
    background: rgba(67, 56, 202, 0.08);
}

.manage-library-body .table-secondary {
    background: rgba(67, 56, 202, 0.06);
}

/* --- Mobile tightening: trim padding, headings, and logo so the layout reads less bulky on small screens --- */
@media (max-width: 600px) {
    main.main-content {
        padding: 0.85rem 0.75rem 1.25rem;
    }

    .library-app-bar.mdc-top-app-bar {
        --library-brand-logo: min(56px, 16vw);
    }

    .library-app-bar .mdc-top-app-bar__row {
        flex-wrap: nowrap;
        gap: 0.4rem;
    }

    .library-app-bar .mdc-top-app-bar__section {
        flex-wrap: nowrap;
        min-width: 0;
    }

    .library-app-bar .mdc-top-app-bar__section--align-end {
        flex: 0 0 auto;
    }

    .user-dropdown-summary {
        padding: 0.3rem 0.55rem;
        font-size: 0.85rem;
    }

    .library-app-bar .app-brand {
        gap: 0.4rem;
        min-width: 0;
    }

    .library-app-bar .app-brand__name {
        font-size: clamp(1rem, 4.4vw, 1.25rem);
    }

    .library-nav-ribbon__inner {
        gap: 0.15rem;
        padding: 0.3rem 0.35rem 0.35rem;
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    a.library-nav-ribbon__tab {
        padding: 0.22rem 0.4rem;
        font-size: 0.75rem;
        letter-spacing: 0;
        border-width: 0;
    }

    a.library-nav-ribbon__tab.active {
        border-width: 1px;
    }

    .library-nav-ribbon__tab--right {
        margin-left: 0;
    }

    .library-nav-ribbon__tab .ribbon-label-full {
        display: none;
    }

    .library-nav-ribbon__tab .ribbon-label-short {
        display: inline;
    }

    .hero-banner {
        padding: 0.75rem 0.85rem 0.85rem;
        margin-bottom: 0.85rem;
        border-radius: var(--sl-radius-sm);
    }

    .hero-content h1 {
        font-size: 1.25rem;
        margin-bottom: 0.35rem;
        line-height: 1.18;
    }

    .home-hero .hero-content h1 {
        font-size: clamp(1.2rem, 5.4vw, 1.5rem);
    }

    .home-welcome-copy {
        margin-bottom: 0;
    }

    .home-welcome-copy p {
        font-size: 0.88rem;
        line-height: 1.5;
        margin-bottom: 0.6rem;
    }

    .home-welcome-copy p:last-child {
        margin-bottom: 0;
    }

    .home-page {
        gap: 1rem;
    }

    .home-explore {
        padding: 1rem 0.95rem 1.05rem;
    }

    .home-section-heading {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }

    .home-tile-grid {
        gap: 0.6rem;
    }

    a.home-tile {
        padding: 0.85rem 0.9rem;
    }

    .mdc-card {
        border-radius: var(--sl-radius-sm);
        box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
    }

    .contact-page-shell {
        padding: 0.85rem 0.9rem 1rem;
    }

    .contact-message-box {
        min-height: 110px;
    }

    .catalog-page-title,
    .account-manage-page-title {
        font-size: 1.35rem;
    }

    .catalog-page-subtitle {
        font-size: 0.92rem;
    }

    .account-manage-header {
        padding: 0.9rem 0.9rem 0.75rem;
    }

    .account-manage-content {
        padding: 0.9rem 0.9rem 1.1rem;
    }

    main.main-content h1:not(.mdc-typography),
    main.main-content h2:not(.mdc-typography) {
        line-height: 1.18;
    }

    .site-footer {
        padding: 0.4rem 0.75rem 1rem;
    }

    .home-growth-margins {
        justify-content: center;
        gap: 0.6rem;
    }

    .home-growth-counter {
        width: min(100%, 200px);
        padding: 0.45rem 0.55rem 0.6rem;
        border-radius: 10px;
    }

    .home-growth-counter__icon-wrap {
        min-height: 110px;
        margin-bottom: 0.2rem;
    }

    .home-growth-counter__label {
        font-size: 0.78rem;
        margin-bottom: 0.4rem;
    }

    .home-growth-counter__flip {
        min-width: 88px;
        height: 46px;
        padding: 0 0.5rem;
        font-size: 1.4rem;
        letter-spacing: 0.04em;
    }

    .home-growth-counter__flip::before {
        inset: 5px;
        border-radius: 5px;
    }

    .home-growth-counter__flip::after {
        left: 7px;
        right: 7px;
    }

    .user-dropdown-summary__name {
        display: none;
    }

    .user-dropdown-summary__initials {
        display: inline;
        font-weight: 700;
        letter-spacing: 0.05em;
    }

    /* Catalog: ensure filter and sort scroll naturally with the books on mobile */
    .catalog-filters,
    .catalog-sort-bar {
        position: static;
        top: auto;
        z-index: auto;
    }

    .catalog-filters {
        background: #f8fafc;
    }

    .catalog-sort-bar {
        background: #f8fafc;
    }

    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .catalog-body {
        padding: 0.55rem 0.6rem 0.65rem;
    }

    .catalog-card-title {
        font-size: 0.92rem;
        line-height: 1.2;
    }

    .catalog-author {
        font-size: 0.8rem;
    }

    .catalog-card-series {
        font-size: 0.7rem;
        margin: 0.25rem 0 0.5rem;
    }

    /* Profile/Manage tabs: wrap to two rows instead of a horizontal scroll bar */
    .account-tabs {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.15rem 0.2rem;
        overflow: visible;
        margin: 0 0.4rem;
        padding: 0.25rem 0;
        scrollbar-width: none;
    }

    .account-tabs::-webkit-scrollbar {
        display: none;
    }

    .account-tab {
        padding: 0.5rem 0.4rem;
        font-size: 0.78rem;
        line-height: 1.15;
        text-align: center;
        white-space: normal;
        margin-bottom: 0;
    }

    .account-tab.active {
        border-bottom-width: 2px;
    }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    display: grid;
    place-items: center;
    z-index: 11000;
    padding: 1rem;
}

.modal-card {
    position: relative;
    z-index: 11001;
    width: min(680px, 100%);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(248, 238, 221, 0.98) 0%, rgba(241, 224, 194, 0.98) 100%);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(122, 82, 38, 0.24);
}

.modal-card h3 {
    margin-top: 0;
}

.admin-user-detail-shell {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(241, 245, 255, 0.95) 100%);
    border: 1px solid rgba(67, 56, 202, 0.14);
    border-radius: var(--sl-radius);
    padding: 1rem 1.1rem 1.3rem;
    color: var(--sl-ink);
}

.admin-user-detail-shell h1,
.admin-user-detail-shell h2,
.admin-user-detail-shell p,
.admin-user-detail-shell th,
.admin-user-detail-shell td,
.admin-user-detail-shell a {
    color: var(--sl-ink);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.form-grid {
    display: grid;
    gap: 0.65rem;
}

.form-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    align-items: start;
    gap: 0.75rem;
}

.form-row .form-label {
    margin-top: 0.35rem;
}

.currency-input {
    display: grid;
    grid-template-columns: 2rem 1fr;
    align-items: center;
    border: 1px solid #b0bec5;
    border-radius: 4px;
    background: #fff;
    max-width: 32rem;
}

.currency-prefix {
    text-align: center;
    color: var(--sl-muted);
    font-weight: 600;
}

.currency-input .form-control {
    border: 0;
    max-width: 100%;
}

.currency-input .form-control:focus {
    outline: none;
    box-shadow: none;
}

@media (max-width: 700px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .form-row .form-label {
        margin-top: 0;
    }
}

/* Cards and tables in body */
.mat-h4, .mat-h5, main h1, main h2, main h3 {
    color: var(--sl-ink);
}

main h1:not(.mdc-typography),
main h2:not(.mdc-typography),
main h3:not(.mdc-typography) {
    font-family: var(--sl-font-display);
    letter-spacing: -0.02em;
}

.mdc-card {
    background: var(--sl-surface);
    color: var(--sl-ink);
    border-radius: var(--sl-radius);
    border: 1px solid rgba(122, 82, 38, 0.16);
    box-shadow: var(--sl-shadow);
}

.mdc-card .mdc-typography {
    color: var(--sl-ink);
}

/* Legacy nav (if any page still uses it) */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: #1a1a2e;
    color: #eee;
}

.nav-brand {
    font-weight: 700;
    color: #eaeaea;
    text-decoration: none;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
}

.nav-links a {
    color: #c8d6e5;
    text-decoration: none;
}

.nav-links a:hover {
    color: #fff;
    text-decoration: underline;
}

.staff-nav-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #cfd8dc;
}

.staff-nav-inline a {
    color: var(--sl-link);
    font-weight: 600;
    text-decoration: none;
}

.staff-nav-inline a:hover {
    text-decoration: underline;
}

.form-control {
    width: 100%;
    max-width: 32rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid #b0bec5;
    border-radius: 8px;
    background: #fff;
    color: var(--sl-ink);
}

.form-control:focus {
    outline: 2px solid rgba(99, 102, 241, 0.25);
    border-color: rgba(67, 56, 202, 0.5);
    box-shadow: 0 0 0 2px rgba(67, 56, 202, 0.1);
}

/* Keep submit/actions from touching the preceding field block. */
form .mb-3 + .btn,
form .mb-3 + button.btn,
form .mb-3 + .mdc-button,
form .form-floating + .btn,
form .form-floating + button.btn {
    margin-top: 0.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th, .table td {
    border: 1px solid #cfd8dc;
    padding: 0.5rem 0.6rem;
    text-align: left;
    color: var(--sl-ink);
}

.table th {
    background: #f8fafc;
    color: var(--sl-ink-soft);
    letter-spacing: 0.01em;
}

.my-rentals-page .muted {
    color: #273244;
}

.rental-due-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0 0 0.2rem 0;
    line-height: 1.25;
}

.rental-due-label--green {
    color: #15803d;
}

.rental-due-label--red {
    color: #b91c1c;
}

.my-rentals-table th {
    background: #eaf0ff;
    color: #1b2540;
}

.my-rentals-table td {
    color: #111827;
}

.my-rentals-late-card {
    background: #f8fbff;
    border: 1px solid #c9d7f2;
    color: #0f172a;
}

.btn {
    display: inline-block;
    padding: 0.4rem 0.95rem;
    background: linear-gradient(180deg, var(--sl-primary) 0%, var(--sl-primary-hover) 100%);
    color: #fff !important;
    text-shadow: none;
    border: 1px solid rgba(30, 27, 75, 0.9);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(49, 46, 129, 0.25);
}

.btn:hover {
    background: linear-gradient(180deg, #4338ca 0%, #1e1b4b 100%);
    box-shadow: 0 4px 12px rgba(49, 46, 129, 0.32);
}

.btn-secondary {
    background: linear-gradient(180deg, #64748b 0%, #475569 100%);
    border-color: #475569;
    color: #fff !important;
    text-shadow: none;
    box-shadow: 0 2px 6px rgba(71, 85, 105, 0.25);
}

.btn-secondary:hover {
    background: linear-gradient(180deg, #475569 0%, #334155 100%);
}

.btn:disabled,
.btn[disabled] {
    background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
    border-color: #94a3b8;
    color: #f1f5f9 !important;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 1;
}

.btn:disabled:hover,
.btn[disabled]:hover {
    background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
    box-shadow: none;
}

.field {
    margin-bottom: 0.75rem;
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: rgba(0, 0, 0, 0.87);
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: var(--sl-danger);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

#blazor-error-ui {
    z-index: 9999;
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color, #666);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
