:root {
    --lazy-catalog-unlocked: #278a52;
    --lazy-catalog-open-action: #4662d2;
    --lazy-catalog-open-action-hover: #304aaf;
}

.lazy-catalog-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
    padding: 0;
    list-style: none;
}

.lazy-catalog-list-item {
    border-top: 1px dashed var(--shell-border, #eadfdc);
}

.lazy-catalog-list-item:first-child {
    border-top: 0;
}

.lazy-catalog-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 7px 0;
    text-align: left;
}

a.lazy-catalog-row {
    border: 0;
    background: transparent;
    color: inherit;
    text-decoration: none;
}

.lazy-catalog-title-button {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.lazy-catalog-title-button:disabled {
    cursor: wait;
    opacity: .72;
}

.lazy-catalog-number {
    flex: 0 0 auto;
    min-width: 32px;
    color: var(--shell-muted, #8a7a7e);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.lazy-catalog-title-wrap {
    min-width: 0;
    flex: 1 1 auto;
}

.lazy-catalog-title {
    display: block;
    overflow: hidden;
    color: var(--shell-ink, #2a2224);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lazy-catalog-row:hover .lazy-catalog-title,
.lazy-catalog-row:focus-within .lazy-catalog-title {
    color: var(--shell-accent, #c97882);
}

.lazy-catalog-time {
    flex: 0 0 auto;
    color: var(--shell-muted, #8a7a7e);
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
}

.lazy-catalog-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    color: var(--shell-muted, #8a7a7e);
    font-size: 11px;
    white-space: nowrap;
}

.lazy-catalog-state svg {
    width: 13px;
    height: 13px;
}

.lazy-catalog-state.is-ready {
    color: #3f8d5d;
}

.lazy-catalog-state.is-failed {
    color: #c86b45;
}

.lazy-catalog-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex: 0 0 auto;
    min-width: 0;
}

.lazy-catalog-lock-button,
.lazy-catalog-confirm-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease, box-shadow .15s ease, opacity .15s ease, transform .15s ease;
}

.lazy-catalog-lock-button {
    width: 24px;
    height: 24px;
    color: var(--shell-muted, #8a7a7e);
}

.lazy-catalog-lock-button svg,
.lazy-catalog-open-icon svg {
    width: 15px;
    height: 15px;
}

.lazy-catalog-lock-button:hover:not(:disabled),
.lazy-catalog-lock-button:focus-visible:not(:disabled) {
    color: var(--lazy-catalog-open-action);
}

.lazy-catalog-lock-button:disabled,
.lazy-catalog-confirm-button:disabled {
    cursor: wait;
    opacity: .62;
}

.lazy-catalog-open-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    color: var(--lazy-catalog-unlocked);
}

.lazy-catalog-quote {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    white-space: nowrap;
}

.lazy-catalog-quote[hidden] {
    display: none !important;
}

.lazy-catalog-price {
    color: var(--shell-accent, #c97882);
    font-size: 12px;
    font-weight: 700;
}

.lazy-catalog-confirm-button {
    min-height: 26px;
    padding: 0 2px;
    border-bottom: 1px solid currentColor;
    color: var(--lazy-catalog-open-action);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.lazy-catalog-confirm-button:hover:not(:disabled),
.lazy-catalog-confirm-button:focus-visible:not(:disabled) {
    background: transparent;
    color: var(--lazy-catalog-open-action-hover);
}

.lazy-catalog-confirm-button:hover:not(:disabled) {
    transform: none;
}

.lazy-catalog-confirm-button:focus-visible:not(:disabled) {
    outline: 2px solid rgba(70, 98, 210, .34);
    outline-offset: 2px;
}

.lazy-catalog-message {
    color: var(--shell-muted, #8a7a7e);
    font-size: 11px;
    white-space: nowrap;
}

.lazy-catalog-message:empty {
    display: none;
}

.lazy-catalog-message.is-error {
    color: #c86b45;
}

.lazy-catalog-batch {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 8px;
    color: var(--shell-muted, #8a7a7e);
    font-size: 12px;
}

.lazy-catalog-batch-toggle,
.lazy-catalog-batch-chip,
.lazy-catalog-batch-quote-button,
.lazy-catalog-batch-confirm {
    min-height: 28px;
    margin: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.lazy-catalog-batch-toggle {
    color: var(--lazy-catalog-open-action);
}

.lazy-catalog-batch-toggle.is-active {
    color: var(--lazy-catalog-open-action-hover);
}

.lazy-catalog-batch-panel {
    display: inline-flex;
    align-items: center;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 6px;
}

.lazy-catalog-batch-panel[hidden] {
    display: none !important;
}

.lazy-catalog-batch-chip,
.lazy-catalog-batch-quote-button {
    padding: 0 6px;
    color: var(--shell-muted, #8a7a7e);
}

.lazy-catalog-batch-chip:hover,
.lazy-catalog-batch-chip:focus-visible,
.lazy-catalog-batch-quote-button:hover:not(:disabled),
.lazy-catalog-batch-quote-button:focus-visible:not(:disabled) {
    color: var(--lazy-catalog-open-action);
}

.lazy-catalog-batch-input {
    width: 48px;
    min-height: 28px;
    padding: 0 3px;
    border: 0;
    border-bottom: 1px solid var(--shell-border, #eadfdc);
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: 12px;
    text-align: center;
    outline: 0;
}

.lazy-catalog-batch-input:focus {
    border-bottom-color: var(--lazy-catalog-open-action);
}

.lazy-catalog-batch-quote-button:disabled {
    cursor: default;
    opacity: .52;
}

.lazy-catalog-batch-price {
    color: var(--shell-accent, #c97882);
    font-weight: 700;
    white-space: nowrap;
}

.lazy-catalog-batch-confirm {
    padding: 0 2px;
    border-bottom: 1px solid currentColor;
    color: var(--lazy-catalog-open-action);
    white-space: nowrap;
}

.lazy-catalog-batch-confirm:hover:not(:disabled),
.lazy-catalog-batch-confirm:focus-visible:not(:disabled) {
    background: transparent;
    color: var(--lazy-catalog-open-action-hover);
}

.lazy-catalog-batch-confirm:disabled {
    cursor: wait;
    opacity: .65;
}

.lazy-catalog-batch-message {
    color: var(--shell-muted, #8a7a7e);
    font-size: 11px;
}

.lazy-catalog-batch-message.is-error {
    color: #c86b45;
}

.lazy-catalog-select {
    display: none;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--lazy-catalog-open-action);
    cursor: pointer;
}

.lazy-catalog-list.is-selecting .lazy-catalog-select {
    display: block;
}

@media (min-width: 768px) {
    .lazy-catalog-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 24px;
    }

    .lazy-catalog-list-item:nth-child(-n+2) {
        border-top: 0;
    }
}

@media (max-width: 575px) {
    .lazy-catalog-row {
        gap: 7px;
        padding: 6px 0;
    }

    .lazy-catalog-number {
        min-width: 28px;
    }

    .lazy-catalog-title {
        font-size: 13px;
    }

    .lazy-catalog-actions {
        gap: 3px;
    }

    .lazy-catalog-quote {
        gap: 5px;
    }

    .lazy-catalog-list-item.is-quoted .lazy-catalog-message:not(.is-error) {
        display: none;
    }

    .lazy-catalog-lock-button,
    .lazy-catalog-open-icon {
        width: 28px;
        height: 28px;
    }

    .lazy-catalog-confirm-button {
        min-height: 28px;
        padding: 0 2px;
    }

    .lazy-catalog-batch {
        gap: 4px 6px;
        margin-bottom: 7px;
    }

    .lazy-catalog-batch-panel {
        gap: 4px;
    }

    .lazy-catalog-batch-input {
        width: 42px;
    }
}

body.dark .lazy-catalog-list-item {
    border-color: var(--shell-border, rgba(255,255,255,.08));
}

body.dark .lazy-catalog-title {
    color: var(--shell-ink, #f4eaef);
}

body.dark .lazy-catalog-lock-button {
    color: #b9a8b2;
}

body.dark .lazy-catalog-open-icon {
    color: #75c98e;
}

body.dark .lazy-catalog-confirm-button {
    background: transparent;
    color: #a5b5ff;
}

body.dark .lazy-catalog-confirm-button:hover:not(:disabled),
body.dark .lazy-catalog-confirm-button:focus-visible:not(:disabled) {
    background: transparent;
    color: #d0d7ff;
}

body.dark .lazy-catalog-batch-confirm {
    background: transparent;
    color: #a5b5ff;
}

body.dark .lazy-catalog-batch-confirm:hover:not(:disabled),
body.dark .lazy-catalog-batch-confirm:focus-visible:not(:disabled) {
    background: transparent;
    color: #d0d7ff;
}

/* Reader TOC: give dense catalog rows clear rhythm without adding cards. */
.chapter-toc-panel .lazy-catalog-batch {
    gap: 6px;
    min-height: 42px;
    margin: 0;
    padding: 8px 12px 7px;
    border-bottom: 1px solid var(--shell-border, #eadfdc);
}

.chapter-toc-panel .lazy-catalog-batch-toggle {
    min-height: 27px;
    padding: 0 1px;
    border-bottom: 1px solid currentColor;
    color: var(--lazy-catalog-open-action);
    font-weight: 700;
}

.chapter-toc-panel .lazy-catalog-batch-panel {
    padding-top: 2px;
}

.chapter-toc-panel .lazy-catalog-list {
    grid-template-columns: minmax(0, 1fr) !important;
    margin: 0 11px;
    padding: 3px 0 9px;
}

.chapter-toc-panel .lazy-catalog-list-item {
    border-color: rgba(42, 34, 36, .07);
}

.chapter-toc-panel .lazy-catalog-list-item:first-child {
    border-top: 0;
}

.chapter-toc-panel .lazy-catalog-list-item:nth-child(n + 2) {
    border-top: 1px solid rgba(42, 34, 36, .07);
}

.chapter-toc-panel .lazy-catalog-row {
    box-sizing: border-box;
    width: 100%;
    min-height: 51px;
    padding: 10px 2px;
    column-gap: 9px;
}

.chapter-toc-panel .lazy-catalog-row--ready,
.chapter-toc-panel .lazy-catalog-row--locked {
    display: grid;
    grid-template-columns: 37px minmax(0, 1fr) max-content 28px;
    grid-template-areas: "number title time actions";
    align-items: center;
}

.chapter-toc-panel .lazy-catalog-row--busy {
    display: grid;
    grid-template-columns: 37px minmax(0, 1fr) max-content;
    grid-template-areas:
        "number title state"
        "number title time";
    align-items: center;
    row-gap: 1px;
}

.chapter-toc-panel .lazy-catalog-number {
    grid-area: number;
    min-width: 0;
    color: var(--shell-muted, #8a7a7e);
    font-size: 11px;
    font-weight: 700;
}

.chapter-toc-panel .lazy-catalog-title-wrap,
.chapter-toc-panel .lazy-catalog-title-button {
    grid-area: title;
}

.chapter-toc-panel .lazy-catalog-title-button {
    width: 100%;
}

.chapter-toc-panel .lazy-catalog-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.42;
}

.chapter-toc-panel .lazy-catalog-time {
    grid-area: time;
    max-width: 72px;
    overflow: hidden;
    color: var(--shell-muted, #8a7a7e);
    font-size: 10.5px;
    text-overflow: ellipsis;
}

.chapter-toc-panel .lazy-catalog-state {
    grid-area: state;
    justify-self: end;
    font-size: 10.5px;
}

.chapter-toc-panel .lazy-catalog-actions,
.chapter-toc-panel .lazy-catalog-open-icon {
    grid-area: actions;
    justify-self: end;
}

.chapter-toc-panel .lazy-catalog-lock-button,
.chapter-toc-panel .lazy-catalog-open-icon {
    width: 28px;
    height: 28px;
}

.chapter-toc-panel .lazy-catalog-list.is-selecting .lazy-catalog-row--locked {
    grid-template-columns: 37px 16px minmax(0, 1fr) max-content 28px;
    grid-template-areas: "number select title time actions";
}

.chapter-toc-panel .lazy-catalog-select {
    grid-area: select;
}

.chapter-toc-panel .chapter-list-pagination {
    margin: 0;
    padding: 9px 12px 11px !important;
}

.chapter-toc-panel .chapter-list-pagination nav {
    flex-wrap: nowrap !important;
    justify-content: center !important;
    gap: 5px !important;
    overflow-x: auto;
    padding: 0 1px;
    scrollbar-width: none;
}

.chapter-toc-panel .chapter-list-pagination nav::-webkit-scrollbar {
    display: none;
}

.chapter-toc-panel .chapter-page-btn,
.chapter-toc-panel .chapter-page-ellipsis {
    flex: 0 0 auto;
}

body.dark .chapter-toc-panel .lazy-catalog-batch,
body.dark .chapter-toc-panel .lazy-catalog-list-item:nth-child(n + 2) {
    border-color: rgba(255, 255, 255, .08);
}

@media (max-width: 375px) {
    .chapter-toc-panel .lazy-catalog-list {
        margin-right: 8px;
        margin-left: 8px;
    }

    .chapter-toc-panel .lazy-catalog-row--ready,
    .chapter-toc-panel .lazy-catalog-row--locked {
        grid-template-columns: 33px minmax(0, 1fr) max-content 26px;
        column-gap: 7px;
    }

    .chapter-toc-panel .lazy-catalog-list.is-selecting .lazy-catalog-row--locked {
        grid-template-columns: 33px 16px minmax(0, 1fr) max-content 26px;
    }

    .chapter-toc-panel .lazy-catalog-time {
        max-width: 61px;
        font-size: 10px;
    }
}
