.jq-library-books {
    --jq-border: #d8dee6;
    --jq-muted: #5f6b7a;
    --jq-background: #ffffff;
    --jq-soft-background: #f5f7fa;
    --jq-text: #17202a;
    width: 100%;
    color: var(--jq-text);
}

.jq-library-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.jq-library-title {
    margin: 0 0 6px;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.2;
}

.jq-library-subtitle {
    margin: 0;
    color: var(--jq-muted);
}

.jq-library-count {
    display: inline-flex;
    gap: 5px;
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid var(--jq-border);
    border-radius: 999px;
    background: var(--jq-soft-background);
    font-weight: 600;
}

.jq-library-controls {
    display: grid;
    grid-template-columns: minmax(230px, 2fr) repeat(3, minmax(140px, 1fr)) auto;
    gap: 10px;
    margin-bottom: 18px;
}

.jq-library-search-field,
.jq-library-filter-field {
    display: block;
}

.jq-library-search,
.jq-library-filter,
.jq-library-reset,
.jq-library-pagination button {
    min-height: 44px;
    border: 1px solid var(--jq-border);
    border-radius: 6px;
    font: inherit;
}

.jq-library-search,
.jq-library-filter {
    width: 100%;
    padding: 9px 12px;
    color: var(--jq-text);
    background: var(--jq-background);
}

.jq-library-reset,
.jq-library-pagination button {
    padding: 9px 15px;
    cursor: pointer;
    color: var(--jq-text);
    background: var(--jq-soft-background);
    font-weight: 600;
}

.jq-library-reset:hover,
.jq-library-pagination button:hover:not(:disabled) {
    background: #e9edf2;
}

.jq-library-search:focus,
.jq-library-filter:focus,
.jq-library-reset:focus,
.jq-library-pagination button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.jq-library-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--jq-border);
    border-radius: 8px;
    background: var(--jq-background);
}

.jq-library-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    margin: 0;
}

.jq-library-table th,
.jq-library-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--jq-border);
    text-align: left;
    vertical-align: top;
}

.jq-library-table th {
    background: var(--jq-soft-background);
    font-weight: 700;
    white-space: nowrap;
}

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

.jq-library-table tbody tr:hover {
    background: #fafbfd;
}

.jq-library-book-name {
    font-weight: 700;
}

.jq-library-empty,
.jq-library-notice {
    padding: 18px;
    border: 1px solid var(--jq-border);
    border-radius: 8px;
    background: var(--jq-soft-background);
    text-align: center;
}

.jq-library-error {
    border-color: #c53030;
}

.jq-library-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
}

.jq-library-pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.jq-library-row[hidden],
.jq-library-empty[hidden],
.jq-library-pagination[hidden] {
    display: none !important;
}

@media (max-width: 1050px) {
    .jq-library-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .jq-library-search-field {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .jq-library-header {
        display: block;
    }

    .jq-library-count {
        margin-top: 14px;
    }

    .jq-library-controls {
        grid-template-columns: 1fr;
    }

    .jq-library-search-field {
        grid-column: auto;
    }

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

    .jq-library-table,
    .jq-library-table tbody,
    .jq-library-table tr,
    .jq-library-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .jq-library-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .jq-library-table tr {
        margin-bottom: 14px;
        border: 1px solid var(--jq-border);
        border-radius: 8px;
        background: var(--jq-background);
        overflow: hidden;
    }

    .jq-library-table td {
        display: grid;
        grid-template-columns: minmax(105px, 36%) 1fr;
        gap: 12px;
        padding: 10px 12px;
    }

    .jq-library-table td::before {
        content: attr(data-label);
        font-weight: 700;
    }

    .jq-library-table tbody tr:last-child td {
        border-bottom: 1px solid var(--jq-border);
    }

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