body {
    background: #f5f7fb;
}

.library-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.library-add-link,
.library-back-link,
.library-form-actions a {
    text-decoration: none;
    font-weight: 700;
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.library-row-link {
    text-decoration: none;
    color: inherit;
}

.library-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid #ddd;
    border-left: 6px solid transparent;
    border-radius: 10px;
    background: #fff;
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.library-row-link:hover .library-row {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border-color: #ccc;
}

.library-row--unread {
    border-left-color: transparent;
}

.library-row--reading {
    border-left-color: #1e88e5;
}

.library-row--read {
    border-left-color: #9e9e9e;
}

.library-row--borrowed {
    border-left-color: #fb8c00;
}

.library-row--given-away {
    border-left-color: #e53935;
}

.library-row__cover,
.library-row__cover-placeholder {
    width: 58px;
    height: 82px;
    border-radius: 4px;
    flex: 0 0 auto;
}

.library-row__cover {
    object-fit: cover;
}

.library-row__cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
    font-size: 11px;
    color: #777;
}

.library-row__content {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.library-row__header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.library-row__title {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.25;
}

.library-row__meta {
    font-size: 0.9rem;
    color: #555;
}

.library-row__meta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.86rem;
    color: #666;
}

.library-badge,
.library-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.library-badge {
    padding: 4px 8px;
    font-size: 0.7rem;
    background: #eceff1;
    color: #37474f;
}

.library-badge--kindle {
    background: #ede7f6;
    color: #5e35b1;
}

.library-badge--paperback {
    background: #e3f2fd;
    color: #1565c0;
}

.library-badge--hardcover {
    background: #f5f5f5;
    color: #424242;
}

.library-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.library-status {
    padding: 4px 8px;
    font-size: 0.72rem;
    background: #eeeeee;
    color: #555;
}

.library-status--unread {
    background: #f5f5f5;
    color: #616161;
}

.library-status--reading {
    background: #e3f2fd;
    color: #1565c0;
}

.library-status--read {
    background: #e8f5e9;
    color: #2e7d32;
}

.library-status--own {
    background: #eceff1;
    color: #455a64;
}

.library-status--lent,
.library-status--borrowed {
    background: #fff3e0;
    color: #ef6c00;
}

.library-status--given-away {
    background: #ffebee;
    color: #c62828;
}

.library-form-page {
    max-width: 1040px;
    margin: 0 auto;
}

.library-back-link {
    display: inline-flex;
    margin-bottom: 16px;
}

.library-form-header {
    margin-bottom: 20px;
}

.library-form-header h1 {
    margin-bottom: 4px;
}

.library-form-header p {
    margin-top: 0;
    color: #666;
}

.library-card {
    padding: 18px;
    margin-bottom: 18px;
    border: 1px solid #ddd;
    border-radius: 14px;
    background: #fff;
}

.library-card h2 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 1.1rem;
}

.isbn-lookup-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.library-book-form {
    display: flex;
    flex-direction: column;
}

.library-book-main {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 22px;
}

.library-cover-panel {
    display: flex;
    justify-content: center;
}

.library-cover-preview,
.library-cover-empty {
    width: 150px;
    height: 220px;
    border-radius: 10px;
}

.library-cover-preview {
    object-fit: cover;
    border: 1px solid #ddd;
}

.library-cover-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
    color: #777;
    font-size: 0.9rem;
}

.library-main-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field--grow {
    flex: 1;
}

.form-field--full {
    grid-column: 1 / -1;
}

.form-field label {
    font-weight: 700;
    font-size: 0.9rem;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font: inherit;
    background: #fff;
}

.form-field textarea {
    resize: vertical;
}

.form-hint {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #eef5ff;
    color: #24527a;
}

.form-hint--warning {
    background: #fff8e1;
    color: #8a5a00;
}

.library-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.library-form-actions button,
.isbn-lookup-form button {
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 760px) {
    .library-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .library-row {
        align-items: flex-start;
        gap: 12px;
    }

    .library-row__cover,
    .library-row__cover-placeholder {
        width: 48px;
        height: 70px;
    }

    .isbn-lookup-form {
        align-items: stretch;
        flex-direction: column;
    }

    .library-book-main {
        grid-template-columns: 1fr;
    }

    .library-cover-panel {
        justify-content: flex-start;
    }

    .form-grid--two {
        grid-template-columns: 1fr;
    }
}

[hidden] {
    display: none !important;
}

.library-detail-page {
    max-width: 1040px;
    margin: 0 auto;
}

.library-detail-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.library-edit-link {
    text-decoration: none;
    font-weight: 700;
}

.library-detail-hero {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 24px;
}

.library-detail-cover-panel {
    display: flex;
    justify-content: center;
}

.library-detail-cover,
.library-detail-cover-empty {
    width: 160px;
    height: 235px;
    border-radius: 12px;
}

.library-detail-cover {
    object-fit: cover;
    border: 1px solid #ddd;
}

.library-detail-cover-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
    color: #777;
}

.library-detail-main h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.15;
}

.library-detail-subtitle {
    margin: 10px 0 14px;
    font-size: 1.15rem;
    color: #555;
}

.library-detail-quick-edit {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.library-detail-quick-edit form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.library-detail-quick-edit label {
    font-weight: 700;
    font-size: 0.85rem;
}

.library-detail-quick-edit select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font: inherit;
    background: #fff;
}

.library-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 22px;
    margin: 0;
}

.library-detail-grid div {
    min-width: 0;
}

.library-detail-grid dt {
    font-weight: 700;
    font-size: 0.85rem;
    color: #555;
}

.library-detail-grid dd {
    margin: 4px 0 0;
}

.library-detail-grid__full {
    grid-column: 1 / -1;
}

.library-detail-url {
    overflow-wrap: anywhere;
    color: #555;
}

.library-detail-text {
    max-width: 820px;
    line-height: 1.55;
    color: #333;
}

@media (max-width: 760px) {
    .library-detail-hero {
        grid-template-columns: 1fr;
    }

    .library-detail-cover-panel {
        justify-content: flex-start;
    }

    .library-detail-quick-edit,
    .library-detail-grid {
        grid-template-columns: 1fr;
    }
}

.container-xl {
    padding-top: 24px;
    padding-bottom: 24px;
}
