﻿.book-detail-shell {
    display: grid;
    gap: 1.5rem;
    min-width: 0;
}

.book-detail-shell > * {
    min-width: 0;
}

/* admin.css fuerza color:#111827 en todos los badges — restaurar texto claro
   en badges con fondo de color (danger, success, secondary) */
.badge.bg-success,
.badge.bg-danger,
.badge.text-bg-success,
.badge.text-bg-danger,
.badge.text-bg-secondary,
.badge.rounded-pill.text-bg-success,
.badge.rounded-pill.text-bg-danger,
.badge.rounded-pill.text-bg-secondary {
    color: #fff !important;
}

.badge.text-bg-warning,
.badge.rounded-pill.text-bg-warning {
    color: #1a2e25 !important;
}

.book-hero-card {
    position: relative;
    overflow: hidden;
    padding: 1.4rem;
    border-radius: 1.8rem;
    border: 1px solid rgba(24, 77, 59, 0.08);
    background:
        radial-gradient(circle at top right, rgba(216, 177, 92, 0.18), transparent 26%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 245, 0.94));
    box-shadow: 0 20px 48px rgba(24, 77, 59, 0.09);
}

.book-hero-card::after {
    content: "";
    position: absolute;
    inset: auto -80px -100px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(43, 122, 93, 0.12), transparent 68%);
    pointer-events: none;
}

.book-cover-panel {
    position: sticky;
    top: 6.6rem;
}

.book-cover-frame {
    position: relative;
    overflow: hidden;
    border-radius: 1.5rem;
    background: linear-gradient(180deg, #f4f8f2 0%, #e8eeea 100%);
    border: 1px solid rgba(24, 77, 59, 0.08);
    box-shadow: 0 18px 38px rgba(24, 77, 59, 0.12);
}

.book-cover-frame::before {
    content: none;
}

.book-cover-image {
    width: 100%;
    height: 520px;
    object-fit: contain;
    display: block;
    border-radius: 0;
    background: linear-gradient(180deg, #fbfaf5, #eef2ec);
    padding: 1rem;
}

.book-cover-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.book-stat-item {
    padding: 1rem;
    border-radius: 1.2rem;
    background: rgba(24, 77, 59, 0.06);
    border: 1px solid rgba(24, 77, 59, 0.1);
    text-align: center;
    transition: all 0.3s ease;
}

.book-stat-item:hover {
    background: rgba(24, 77, 59, 0.1);
    border-color: rgba(24, 77, 59, 0.2);
    transform: translateY(-2px);
}

.book-stat-badge {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    border-radius: 50%;
    background: rgba(29, 101, 76, 0.15);
    color: #1d654c;
    font-size: 1.2rem;
}

.book-stat-item small {
    display: block;
    color: #72847d;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.book-stat-item strong {
    display: block;
    color: #0d5e47;
    font-size: 0.95rem;
    font-weight: 800;
}

.book-summary {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.book-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(24, 77, 59, 0.08);
    color: #205842;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.book-main-title {
    margin: 0;
    color: #173d2f;
    font-size: clamp(1.9rem, 3vw, 2.7rem);
    font-weight: 800;
    line-height: 1.08;
    overflow-wrap: break-word;
    word-break: break-word;
}

.book-authors {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #60726b;
    font-size: 1rem;
    line-height: 1.55;
    font-weight: 500;
}

.book-authors i {
    color: #1d654c;
    font-size: 1.1rem;
}

.book-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.book-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.48rem 0.8rem;
    border-radius: 999px;
    background: rgba(24, 77, 59, 0.07);
    color: #205842;
    font-size: 0.86rem;
    font-weight: 700;
}

.book-main-rating {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: rgba(24, 77, 59, 0.06);
    border: 1px solid rgba(24, 77, 59, 0.08);
}

.book-main-rating-label {
    color: #567168;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.book-main-rating-stars small {
    margin-bottom: 0;
    color: #5c6d67 !important;
    font-size: 0.88rem;
}

.book-quick-specs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    background: rgba(24, 77, 59, 0.04);
    padding: 1.2rem;
    border-radius: 1.2rem;
    border: 1px solid rgba(24, 77, 59, 0.08);
}

.book-spec-item {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
}

.book-spec-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    background: rgba(29, 101, 76, 0.12);
    color: #1d654c;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.book-spec-item > div {
    flex: 1;
}

.book-spec-item small {
    display: block;
    color: #72847d;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.book-spec-item strong {
    display: block;
    color: #173d2f;
    font-size: 1rem;
    font-weight: 800;
}

.book-description-card,
.book-info-card,
.book-comments-card,
.book-related-card {
    border: 1px solid rgba(24, 77, 59, 0.08);
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 18px 38px rgba(24, 77, 59, 0.08);
}

.book-description-card,
.book-info-card,
.book-comments-card {
    padding: 1.2rem 1.25rem;
}

.book-section-title {
    margin-bottom: 0.85rem;
    color: #173d2f;
    font-size: 1.15rem;
    font-weight: 800;
}

.book-description-text {
    margin: 0;
    color: #556861;
    line-height: 1.75;
}

.book-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.book-info-item {
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: rgba(24, 77, 59, 0.04);
    border: 1px solid rgba(24, 77, 59, 0.06);
}

.book-info-item strong {
    display: block;
    color: #1a4b39;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.book-info-item span {
    display: block;
    margin-top: 0.25rem;
    color: #5a6c65;
}

.book-topic-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.book-topic {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.72rem;
    border-radius: 999px;
    background: rgba(216, 177, 92, 0.14);
    color: #8d6318;
    font-size: 0.82rem;
    font-weight: 700;
}

.book-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.book-info-alert {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.2rem;
    border-radius: 1.15rem;
    border: 1px solid rgba(79, 187, 152, 0.25);
    background: linear-gradient(135deg, rgba(79, 187, 152, 0.08), rgba(79, 187, 152, 0.04));
}

.book-alert-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(29, 101, 76, 0.15);
    color: #1d654c;
    font-size: 1.2rem;
}

.book-alert-content {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

.book-alert-content strong {
    display: block;
    color: #1d654c;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.book-alert-content p {
    color: #556861;
    font-size: 0.9rem;
    line-height: 1.55;
}

.book-action-primary,
.book-action-secondary {
    min-height: 50px;
    padding: 0.85rem 1.4rem;
    border-radius: 1.05rem;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.book-action-primary {
    color: #fff;
    border: 0;
    background: linear-gradient(135deg, #3fa883 0%, #2d8a6c 100%);
    box-shadow: 0 12px 28px rgba(29, 101, 76, 0.22);
}

.book-action-primary:hover {
    background: linear-gradient(135deg, #2d8a6c 0%, #1f6950 100%);
    box-shadow: 0 16px 36px rgba(29, 101, 76, 0.28);
    transform: translateY(-2px);
}

.book-action-secondary {
    color: #1d654c;
    border: 1.5px solid rgba(24, 77, 59, 0.2);
    background: rgba(24, 77, 59, 0.05);
}

.book-action-secondary:hover {
    background: rgba(24, 77, 59, 0.15);
    border-color: rgba(24, 77, 59, 0.4);
    transform: translateY(-2px);
}

.book-layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.95fr);
    gap: 1.5rem;
}

.book-stack {
    display: grid;
    gap: 1.3rem;
    min-width: 0;
}

.book-subgrid {
    display: grid;
    gap: 1.3rem;
    min-width: 0;
}

.book-copies-grid {
    display: flex;
    flex-direction: column;
    max-height: 34rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.15rem;
}

.book-copies-grid::-webkit-scrollbar {
    width: 8px;
}

.book-copies-grid::-webkit-scrollbar-thumb {
    background: rgba(24, 77, 59, 0.18);
    border-radius: 999px;
}

.book-copies-grid::-webkit-scrollbar-track {
    background: rgba(24, 77, 59, 0.05);
    border-radius: 999px;
}

/* ── Filas de ejemplar ──────────────────────────────────────────────────── */
.book-copy-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid rgba(24, 77, 59, 0.06);
    border-left: 3px solid transparent;
    transition: background 0.15s;
}

.book-copy-row:last-child {
    border-bottom: none;
}

.book-copy-row:hover {
    background: rgba(24, 77, 59, 0.04);
}

.book-copy-row--available { border-left-color: #22c55e; }
.book-copy-row--lent      { border-left-color: #ef4444; }
.book-copy-row--reserved  { border-left-color: #f59e0b; }
.book-copy-row--transfer  { border-left-color: #9ca3af; }

.book-copy-row-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    background: rgba(29, 101, 76, 0.09);
    color: #1d654c;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.book-copy-row--lent     .book-copy-row-icon { background: rgba(239,68,68,0.08); color: #dc2626; }
.book-copy-row--reserved .book-copy-row-icon { background: rgba(245,158,11,0.1); color: #b45309; }
.book-copy-row--transfer .book-copy-row-icon { background: rgba(156,163,175,0.12); color: #6b7280; }

.book-copy-row-body {
    flex: 1;
    min-width: 0;
}

.book-copy-row-code {
    font-size: 0.88rem;
    font-weight: 800;
    color: #173d2f;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-copy-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    margin-top: 0.18rem;
    font-size: 0.76rem;
    color: #748a82;
}

.book-copy-row-lib {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.book-copy-row-lib i {
    font-size: 0.7rem;
}

.bk-sep {
    margin: 0 0.15rem;
    opacity: 0.4;
}

.book-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.85rem;
}

.book-section-heading .book-section-title {
    margin-bottom: 0;
}

.book-section-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.75rem;
    border-radius: 999px;
    background: rgba(24, 77, 59, 0.08);
    color: #235842;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.book-copy-card {
    height: 100%;
    padding: 1rem;
    border-radius: 1.2rem;
    border: 1px solid rgba(24, 77, 59, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 245, 0.92));
    box-shadow: 0 14px 30px rgba(24, 77, 59, 0.06);
}

.book-copy-card-inner {
    display: grid;
    gap: 0.85rem;
    height: 100%;
}

.book-copy-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(24, 77, 59, 0.08);
    color: #1c5a45;
    font-size: 1rem;
}

.book-copy-code {
    color: #173d2f;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.3;
}

.book-copy-library {
    color: #657871;
    font-size: 0.9rem;
    line-height: 1.45;
}

.book-copy-status {
    margin-top: auto;
}

.book-copy-status .badge {
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.book-related-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.15rem;
}

.book-related-card .catalog-grid-tag {
    margin-bottom: 0.7rem;
}

.book-related-card .catalog-grid-title {
    min-height: 2.8rem;
}

.book-related-card .catalog-grid-authors {
    min-height: 2.8rem;
    line-height: 1.5;
}

.book-related-card .catalog-grid-meta {
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.9rem;
}

.book-related-card .catalog-grid-meta small {
    font-size: 0.86rem;
}

.book-related-card .catalog-grid-button {
    padding: 0.55rem 0.88rem;
    border-radius: 0.95rem;
    font-size: 0.86rem;
}

.book-comments-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.8fr);
    gap: 1.3rem;
}

.book-comments-layout > div {
    min-width: 0;
}

.book-comments-list {
    display: grid;
    gap: 1rem;
}

.book-comments-list.is-collapsed .is-extra-comment {
    display: none;
}

.book-comments-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.book-comments-toggle {
    min-width: 220px;
}

.book-rating-panel {
    margin-bottom: 1rem;
    padding: 1rem 1.05rem;
    border-radius: 1.2rem;
    border: 1px solid rgba(24, 77, 59, 0.08);
    background: linear-gradient(135deg, rgba(255, 247, 226, 0.9), rgba(255, 255, 255, 0.94));
}

.book-rating-panel .text-muted {
    color: #6f7d86 !important;
}

/* ── Panel de rating enriquecido ─────────────────────────────────────────── */
.book-rating-summary {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.book-rating-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    min-width: 80px;
}

.book-rating-number {
    font-size: 2.6rem;
    font-weight: 800;
    color: #173d2f;
    line-height: 1;
}

.book-rating-count {
    font-size: 0.75rem;
    color: #7a8d86;
    font-weight: 600;
    text-align: center;
    margin-top: 0.15rem;
}

.book-rating-dist {
    flex: 1;
    display: grid;
    gap: 0.38rem;
    min-width: 0;
}

.book-rating-dist-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.book-rating-dist-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: #4a5e57;
    width: 10px;
    text-align: right;
    flex-shrink: 0;
}

.book-rating-dist-star {
    font-size: 0.7rem;
    color: #d5a437;
    flex-shrink: 0;
}

.book-rating-dist-bar {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: rgba(24, 77, 59, 0.08);
    overflow: hidden;
}

.book-rating-dist-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #d5a437, #e8c060);
    transition: width 0.5s ease;
}

.book-rating-dist-count {
    font-size: 0.75rem;
    color: #7a8d86;
    font-weight: 700;
    width: 22px;
    text-align: right;
    flex-shrink: 0;
}

.book-rating-no-data {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #8a9e97;
    font-size: 0.88rem;
}

.book-rating-no-data i {
    font-size: 1.1rem;
}

/* ── Cards de comentario mejoradas ───────────────────────────────────────── */
.book-comment-rating {
    display: inline-flex;
    align-items: center;
    gap: 0.12rem;
    flex-shrink: 0;
}

.book-comment-rating i {
    font-size: 0.82rem;
    color: #d5a437;
}

/* ── Estado vacío de comentarios ─────────────────────────────────────────── */
.book-comment-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #7a8d86;
}

.book-comment-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.book-comment-empty p {
    font-weight: 600;
    color: #5a6c65;
    margin-bottom: 0.3rem;
}

.book-comment-empty small {
    font-size: 0.84rem;
}

/* ── Formulario de comentario ────────────────────────────────────────────── */
.book-comment-form-hint {
    font-size: 0.85rem;
    color: #7a8d86;
    margin-bottom: 1rem;
}

.book-char-counter {
    text-align: right;
    font-size: 0.76rem;
    color: #9ab0a8;
    margin-top: 0.35rem;
    font-weight: 600;
    transition: color 0.2s;
}

.book-char-counter--warn {
    color: #d97706;
}

.book-char-counter--max {
    color: #dc2626;
}

.book-comment-card {
    padding: 1rem 1.05rem;
    border-radius: 1.2rem;
    border: 1px solid rgba(24, 77, 59, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 246, 0.92));
    box-shadow: 0 14px 30px rgba(24, 77, 59, 0.06);
}

.book-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.7rem;
}

.book-comment-user {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.book-comment-avatar {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(24, 77, 59, 0.08);
    color: #1c5a45;
    font-size: 1rem;
    flex: 0 0 auto;
}

.book-comment-author {
    color: #173d2f;
    font-weight: 800;
    line-height: 1.35;
}

.book-comment-date {
    color: #7b8b84;
    font-size: 0.83rem;
    white-space: nowrap;
}

.book-comment-stars {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    margin-bottom: 0.7rem;
}

.book-comment-stars i {
    color: #d5a437;
}

.book-comment-text {
    margin: 0;
    color: #5b6d66;
    line-height: 1.7;
}

.book-comment-form-card {
    padding: 1.2rem 1.25rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(24, 77, 59, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 248, 245, 0.92));
    box-shadow: 0 18px 38px rgba(24, 77, 59, 0.08);
}

.book-comment-form-card textarea.form-control,
.book-comment-form-card select.form-control {
    border-radius: 1rem;
}

.book-guest-card {
    position: relative;
    overflow: hidden;
    padding: 1.25rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(24, 77, 59, 0.08);
    background:
        radial-gradient(circle at top right, rgba(216, 177, 92, 0.18), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 245, 0.95));
    box-shadow: 0 18px 38px rgba(24, 77, 59, 0.08);
}

.book-guest-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    background: rgba(24, 77, 59, 0.08);
    color: #205842;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.book-guest-title {
    margin: 0.95rem 0 0.5rem;
    color: #173d2f;
    font-size: 1.2rem;
    font-weight: 800;
}

.book-guest-text {
    margin: 0;
    color: #5a6c65;
    line-height: 1.7;
}

.book-guest-points {
    display: grid;
    gap: 0.6rem;
    margin: 1rem 0 1.15rem;
}

.book-guest-point {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    color: #4f625b;
}

.book-guest-point i {
    color: #1d654c;
    margin-top: 0.15rem;
}

.book-guest-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.book-guest-login {
    min-height: 48px;
    border-radius: 1rem;
    font-weight: 700;
}

.book-modal-content {
    border: 0;
    border-radius: 1.6rem;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(216, 177, 92, 0.18), transparent 30%),
        linear-gradient(180deg, #ffffff, #f5f8f6);
    box-shadow: 0 24px 56px rgba(24, 77, 59, 0.18);
}

.book-modal-header {
    padding: 1.3rem 1.35rem 0;
}

.book-modal-title {
    color: #173d2f;
    font-weight: 800;
}

.book-modal-subtitle {
    color: #6b7d76;
}

.book-modal-body {
    padding: 1.1rem 1.35rem 1.35rem;
}

.book-modal-header .btn-close {
    border-radius: 999px;
    padding: 0.8rem;
    background-color: rgba(24, 77, 59, 0.06);
}

.book-modal-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.book-modal-stat {
    padding: 0.85rem 0.9rem;
    border-radius: 1rem;
    border: 1px solid rgba(24, 77, 59, 0.08);
    background: rgba(255, 255, 255, 0.78);
}

.book-modal-stat span {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6f8179;
}

.book-modal-stat strong {
    display: block;
    margin-top: 0.25rem;
    color: #173d2f;
    line-height: 1.45;
}

.book-modal-form {
    padding: 1rem;
    border-radius: 1.15rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(24, 77, 59, 0.08);
}

.book-modal-section-title {
    margin: 0 0 0.3rem;
    color: #173d2f;
    font-size: 1rem;
    font-weight: 800;
}

.book-modal-section-text {
    margin: 0 0 1rem;
    color: #667971;
    font-size: 0.92rem;
    line-height: 1.6;
}

.book-modal-form .form-label {
    color: #1b4f3d;
}

.book-modal-form .form-control {
    min-height: 50px;
    border-radius: 0.95rem;
    border-color: rgba(24, 77, 59, 0.12);
    box-shadow: none;
}

.book-modal-form .form-control:focus {
    border-color: rgba(43, 122, 93, 0.55);
    box-shadow: 0 0 0 0.18rem rgba(43, 122, 93, 0.12);
}

.book-modal-field-help {
    display: block;
    margin-top: 0.45rem;
    color: #71837c;
    font-size: 0.82rem;
    line-height: 1.5;
}

.book-modal-help {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: rgba(24, 77, 59, 0.06);
    color: #526760;
}

.book-modal-help i {
    color: #1d654c;
    margin-top: 0.1rem;
}

/* ── Stepper de pasos ────────────────────────────────────────────────────── */
.book-modal-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.9rem;
    background: rgba(24, 77, 59, 0.04);
    border: 1px solid rgba(24, 77, 59, 0.07);
}

.book-modal-step {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    justify-content: center;
    font-size: 0.8rem;
    color: #9ab0a8;
    font-weight: 700;
    transition: color 0.25s;
}

.book-modal-step--done {
    color: #173d2f;
}

.book-modal-step-num {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(24, 77, 59, 0.08);
    color: #9ab0a8;
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
    transition: background 0.25s, color 0.25s;
}

.book-modal-step--done .book-modal-step-num {
    background: #1d654c;
    color: #fff;
}

.book-modal-step-line {
    flex: 0 0 28px;
    height: 1px;
    background: rgba(24, 77, 59, 0.14);
    display: block;
}

/* ── Tarjetas de modalidad de préstamo ───────────────────────────────────── */
.book-loan-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.book-loan-type {
    cursor: pointer;
    display: block;
}

.book-loan-type input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.book-loan-type-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    border: 1.5px solid rgba(24, 77, 59, 0.1);
    background: rgba(24, 77, 59, 0.03);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    cursor: pointer;
    user-select: none;
    height: 100%;
}

.book-loan-type-card i {
    font-size: 1.25rem;
    color: #7a8f87;
    margin-bottom: 0.2rem;
    transition: color 0.2s;
}

.book-loan-type-card strong {
    font-size: 0.88rem;
    color: #1a4838;
    font-weight: 800;
    line-height: 1.3;
}

.book-loan-type-card small {
    font-size: 0.76rem;
    color: #7a8d86;
    line-height: 1.45;
    margin-top: 0.1rem;
}

.book-loan-type-card:hover {
    border-color: rgba(29, 101, 76, 0.28);
    background: rgba(24, 77, 59, 0.05);
}

.book-loan-type input[type="radio"]:checked + .book-loan-type-card {
    border-color: #1d654c;
    background: rgba(29, 101, 76, 0.07);
    box-shadow: 0 0 0 3px rgba(29, 101, 76, 0.1);
}

.book-loan-type input[type="radio"]:checked + .book-loan-type-card i {
    color: #1d654c;
}

.book-loan-type input[type="radio"]:checked + .book-loan-type-card strong {
    color: #0d5236;
}

/* ── Estado no autenticado en el modal ───────────────────────────────────── */
.book-modal-guest {
    text-align: center;
    padding: 0.5rem 0.25rem 0.25rem;
}

.book-modal-guest-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(24, 77, 59, 0.08);
    color: #1d654c;
    font-size: 1.55rem;
    margin: 0 auto 1rem;
}

.book-modal-guest-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #173d2f;
    margin-bottom: 0.5rem;
}

.book-modal-guest-text {
    color: #5a6c65;
    font-size: 0.9rem;
    line-height: 1.65;
    margin-bottom: 1.1rem;
    max-width: 360px;
    margin-inline: auto;
}

.book-modal-guest-points {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    text-align: left;
    max-width: 290px;
    margin-inline: auto;
}

.book-modal-guest-point {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.87rem;
    color: #4f625b;
    line-height: 1.5;
}

.book-modal-guest-point i {
    color: #1d654c;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.book-modal-guest-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.book-modal-footer {
    display: flex;
    gap: 0.85rem;
    margin-top: 1rem;
}

.book-modal-cancel {
    min-height: 48px;
    border-radius: 1rem;
    border: 1px solid rgba(24, 77, 59, 0.12);
    color: #1b4f3d;
    background: rgba(255, 255, 255, 0.84);
    font-weight: 700;
}

.book-empty-state {
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    background: rgba(24, 77, 59, 0.05);
    color: #5d6f68;
}

body.library-dark .book-hero-card {
    border-color: rgba(255, 255, 255, 0.08) !important;
    background: linear-gradient(135deg, rgba(18, 26, 35, 0.96), rgba(12, 18, 26, 0.93)) !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.3) !important;
}

body.library-dark .book-stat-item {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.library-dark .book-stat-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

body.library-dark .book-stat-badge {
    background: rgba(78, 181, 145, 0.15) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-stat-item small {
    color: #8fa4b4 !important;
}

body.library-dark .book-stat-item strong {
    color: #f3f7fb !important;
}

body.library-dark .book-quick-specs {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.library-dark .book-spec-icon {
    background: rgba(78, 181, 145, 0.15) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-spec-item strong {
    color: #f3f7fb !important;
}

body.library-dark .book-spec-item small {
    color: #8fa4b4 !important;
}

body.library-dark .book-alert-icon {
    background: rgba(78, 181, 145, 0.15) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-info-alert {
    border-color: rgba(78, 181, 145, 0.25) !important;
    background: linear-gradient(135deg, rgba(78, 181, 145, 0.08), rgba(78, 181, 145, 0.04)) !important;
}

body.library-dark .book-alert-content strong {
    color: #86e2c0 !important;
}

body.library-dark .book-alert-content p {
    color: #aebdca !important;
}

body.library-dark .book-action-primary {
    background: linear-gradient(135deg, #3fa883 0%, #2d8a6c 100%) !important;
    box-shadow: 0 12px 28px rgba(63, 168, 131, 0.22) !important;
    color: #ffffff !important;
}

body.library-dark .book-action-primary:hover {
    background: linear-gradient(135deg, #2d8a6c 0%, #1f6950 100%) !important;
    box-shadow: 0 16px 36px rgba(63, 168, 131, 0.28) !important;
}

body.library-dark .book-action-secondary {
    color: #86e2c0 !important;
    border-color: rgba(78, 181, 145, 0.3) !important;
    background: rgba(78, 181, 145, 0.1) !important;
}

body.library-dark .book-action-secondary:hover {
    background: rgba(78, 181, 145, 0.18) !important;
    border-color: rgba(78, 181, 145, 0.5) !important;
}

body.library-dark .book-authors {
    color: #aebdca !important;
}

body.library-dark .book-authors i {
    color: #86e2c0 !important;
}


body.library-dark .book-description-card,
body.library-dark .book-info-card,
body.library-dark .book-comments-card,
body.library-dark .book-related-card,
body.library-dark .book-copy-card,
body.library-dark .book-rating-panel,
body.library-dark .book-comment-form-card,
body.library-dark .book-guest-card,
body.library-dark .book-modal-content,
body.library-dark .book-cover-frame::before,
body.library-dark .book-modal-summary,
body.library-dark .book-modal-footer {
    border-color: rgba(255, 255, 255, 0.08) !important;
    background: linear-gradient(180deg, rgba(18, 26, 35, 0.96), rgba(12, 18, 26, 0.93)) !important;
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.28) !important;
}

body.library-dark .book-modal-header,
body.library-dark .book-modal-body {
    background: transparent !important;
}

body.library-dark .book-cover-frame {
    background: linear-gradient(180deg, #1c2821, #121a16) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.library-dark .book-cover-image {
    background: linear-gradient(180deg, #1c2821, #121a16) !important;
    border: 0 !important;
}

body.library-dark .book-related-card .catalog-grid-tag {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f1c979 !important;
}

body.library-dark .book-main-rating {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.library-dark .book-main-rating-label,
body.library-dark .book-main-rating-stars small {
    color: #c5d3dc !important;
}

body.library-dark .book-related-card {
    background: linear-gradient(180deg, rgba(16, 24, 33, 0.96), rgba(11, 18, 26, 0.94)) !important;
}

body.library-dark .book-main-title,
body.library-dark .book-section-title,
body.library-dark .book-guest-title,
body.library-dark .book-modal-title,
body.library-dark .book-stat-card strong,
body.library-dark .book-cover-meta-card strong,
body.library-dark .book-comment-author,
body.library-dark .book-copy-code {
    color: #f2f6fb !important;
}

body.library-dark .book-authors,
body.library-dark .book-cover-meta-card span,
body.library-dark .book-description-text,
body.library-dark .book-info-item span,
body.library-dark .book-guest-text,
body.library-dark .book-guest-point span,
body.library-dark .book-modal-subtitle,
body.library-dark .book-modal-section-text,
body.library-dark .book-modal-field-help,
body.library-dark .book-comment-text,
body.library-dark .book-copy-library {
    color: #aebdca !important;
}

body.library-dark .book-eyebrow,
body.library-dark .book-chip,
body.library-dark .book-guest-badge,
body.library-dark .book-modal-help,
body.library-dark .book-note-card {
    background: rgba(78, 181, 145, 0.12) !important;
    color: #86e2c0 !important;
    border-color: rgba(78, 181, 145, 0.16) !important;
}

body.library-dark .book-description-card,
body.library-dark .book-info-card,
body.library-dark .book-comments-card,
body.library-dark .book-related-card,
body.library-dark .book-comment-form-card,
body.library-dark .book-guest-card,
body.library-dark .book-rating-panel,
body.library-dark .book-comment-card,
body.library-dark .book-copy-card {
    background: linear-gradient(180deg, rgba(18, 26, 35, 0.96), rgba(12, 18, 26, 0.93)) !important;
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.28) !important;
}

body.library-dark .book-stat-card,
body.library-dark .book-cover-meta-card,
body.library-dark .book-modal-stat,
body.library-dark .book-modal-form,
body.library-dark .book-info-item {
    background: rgba(255, 255, 255, 0.035) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.library-dark .book-note-card {
    background: linear-gradient(135deg, rgba(56, 43, 20, 0.34), rgba(16, 22, 30, 0.92)) !important;
}

body.library-dark .book-description-text,
body.library-dark .book-info-item span,
body.library-dark .book-modal-help div,
body.library-dark .book-guest-text {
    background: transparent !important;
}

body.library-dark .book-section-badge {
    background: rgba(78, 181, 145, 0.12) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-stat-card span,
body.library-dark .book-modal-stat span,
body.library-dark .book-rating-meta,
body.library-dark .book-rating-value,
body.library-dark .book-rating-count,
body.library-dark .book-copy-icon {
    color: #86e2c0 !important;
}

body.library-dark .book-comment-avatar {
    background: rgba(78, 181, 145, 0.12) !important;
    color: #86e2c0 !important;
}


body.library-dark .book-copies-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14) !important;
}

body.library-dark .book-copies-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.library-dark .book-modal-form .form-label {
    color: #f2f6fb !important;
}

body.library-dark .book-modal-steps {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.07) !important;
}

body.library-dark .book-modal-step {
    color: #4d6070 !important;
}

body.library-dark .book-modal-step--done {
    color: #f2f6fb !important;
}

body.library-dark .book-modal-step-num {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #4d6070 !important;
}

body.library-dark .book-modal-step--done .book-modal-step-num {
    background: #3fa883 !important;
    color: #fff !important;
}

body.library-dark .book-modal-step-line {
    background: rgba(255, 255, 255, 0.08) !important;
}

body.library-dark .book-loan-type-card {
    border-color: rgba(255, 255, 255, 0.08) !important;
    background: rgba(255, 255, 255, 0.03) !important;
}

body.library-dark .book-loan-type-card:hover {
    border-color: rgba(78, 181, 145, 0.35) !important;
    background: rgba(78, 181, 145, 0.06) !important;
}

body.library-dark .book-loan-type-card i {
    color: #8fa4b4 !important;
}

body.library-dark .book-loan-type-card strong {
    color: #f2f6fb !important;
}

body.library-dark .book-loan-type-card small {
    color: #8fa4b4 !important;
}

body.library-dark .book-loan-type input[type="radio"]:checked + .book-loan-type-card {
    border-color: #3fa883 !important;
    background: rgba(63, 168, 131, 0.1) !important;
    box-shadow: 0 0 0 3px rgba(63, 168, 131, 0.15) !important;
}

body.library-dark .book-loan-type input[type="radio"]:checked + .book-loan-type-card i {
    color: #86e2c0 !important;
}

body.library-dark .book-loan-type input[type="radio"]:checked + .book-loan-type-card strong {
    color: #86e2c0 !important;
}

body.library-dark .book-modal-guest-icon {
    background: rgba(78, 181, 145, 0.12) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-modal-guest-title {
    color: #f2f6fb !important;
}

body.library-dark .book-modal-guest-text {
    color: #aebdca !important;
}

body.library-dark .book-modal-guest-point {
    color: #aebdca !important;
}

body.library-dark .book-modal-guest-point i {
    color: #86e2c0 !important;
}

body.library-dark .book-modal-summary {
    margin-bottom: 1.1rem;
}

body.library-dark .book-action-secondary,
body.library-dark .book-modal-cancel {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #dbe6ee !important;
}

body.library-dark .book-action-secondary:hover,
body.library-dark .book-modal-cancel:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

body.library-dark .form-control,
body.library-dark textarea.form-control,
body.library-dark select.form-control {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #edf3f8 !important;
}

body.library-dark .form-control::placeholder,
body.library-dark textarea.form-control::placeholder {
    color: #8ea3b3 !important;
}

body.library-dark select.form-control option {
    background: #16212b !important;
    color: #edf3f8 !important;
}

body.library-dark .form-control:focus,
body.library-dark textarea.form-control:focus,
body.library-dark select.form-control:focus {
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(216, 177, 92, 0.45) !important;
    box-shadow: 0 0 0 0.2rem rgba(216, 177, 92, 0.14) !important;
    color: #ffffff !important;
}

body.library-dark .book-empty-state {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px dashed rgba(255, 255, 255, 0.1) !important;
    color: #aebdca !important;
}

body.library-dark .book-modal-help strong {
    color: #f4d18a !important;
}

body.library-dark .modal-header .btn-close {
    filter: invert(1) grayscale(100%) !important;
}

body.library-dark .book-topic {
    background: rgba(216, 177, 92, 0.14) !important;
    color: #f4d18a !important;
}

body.library-dark .book-info-item {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.library-dark .book-info-item strong {
    color: #f2f6fb !important;
}

body.library-dark .book-comment-date {
    color: #8fa4b4 !important;
}

body.library-dark .book-copy-library {
    color: #aebdca !important;
}

body.library-dark .book-rating-number {
    color: #f2f6fb !important;
}

body.library-dark .book-rating-count {
    color: #8fa4b4 !important;
}

body.library-dark .book-rating-dist-label {
    color: #aebdca !important;
}

body.library-dark .book-rating-dist-bar {
    background: rgba(255, 255, 255, 0.07) !important;
}

body.library-dark .book-rating-dist-fill {
    background: linear-gradient(90deg, #c99a35, #e0b855) !important;
}

body.library-dark .book-rating-dist-count {
    color: #8fa4b4 !important;
}

body.library-dark .book-rating-no-data {
    color: #8fa4b4 !important;
}

body.library-dark .book-comment-rating i {
    color: #e0b855 !important;
}

body.library-dark .book-comment-empty {
    color: #8fa4b4 !important;
}

body.library-dark .book-comment-empty p {
    color: #aebdca !important;
}

body.library-dark .book-comment-form-hint {
    color: #8fa4b4 !important;
}

body.library-dark .book-char-counter {
    color: #6b8090 !important;
}

body.library-dark .book-char-counter--warn {
    color: #fbbf24 !important;
}

body.library-dark .book-char-counter--max {
    color: #f87171 !important;
}

@media (max-width: 1199.98px) {
    .book-layout-grid,
    .book-comments-layout {
        grid-template-columns: 1fr;
    }

    .book-cover-panel {
        position: static;
    }

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

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

/* En móvil: mostrar título/autores antes que la portada */
@media (max-width: 991.98px) {
    .book-hero-card .col-lg-4 {
        order: 2;
    }

    .book-hero-card .col-lg-8 {
        order: 1;
    }
}

@media (max-width: 767.98px) {
    .book-hero-card,
    .book-description-card,
    .book-info-card,
    .book-comments-card,
    .book-comment-form-card {
        padding: 1rem;
    }

    .book-stat-grid,
    .book-info-grid,
    .book-copies-grid {
        grid-template-columns: 1fr;
    }

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

    .book-copies-grid {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .book-cover-image {
        height: 320px;
    }

    .book-action-row {
        flex-direction: column;
    }

    .book-action-primary,
    .book-action-secondary {
        width: 100%;
        justify-content: center;
    }

    .book-guest-actions {
        flex-direction: column;
    }

    .book-guest-login {
        width: 100%;
    }

    .book-modal-header,
    .book-modal-body {
        padding-inline: 1rem;
    }

    .book-modal-footer {
        flex-direction: column-reverse;
    }

    .book-modal-cancel,
    .book-modal-footer .book-action-primary {
        width: 100%;
    }

    .book-loan-types {
        grid-template-columns: 1fr;
    }

    .book-modal-guest-actions {
        flex-direction: column;
    }

    .book-modal-guest-actions .btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .book-detail-shell {
        gap: 1rem;
    }

    /* Reducir gutter del row hero en móvil */
    .book-hero-card .row {
        --bs-gutter-x: 0.75rem;
    }

    .book-hero-card {
        padding: 0.85rem;
    }

    .book-cover-image {
        height: 240px;
    }

    .book-cover-stats {
        gap: 0.55rem;
        margin-top: 0.75rem;
    }

    .book-stat-item {
        padding: 0.75rem 0.6rem;
    }

    .book-stat-badge {
        width: 34px;
        height: 34px;
        font-size: 1rem;
        margin-bottom: 0.35rem;
    }

    .book-main-title {
        font-size: 1.3rem;
        line-height: 1.15;
    }

    .book-authors {
        font-size: 0.9rem;
    }

    .book-chip {
        font-size: 0.8rem;
        padding: 0.38rem 0.65rem;
    }

    .book-quick-specs {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        padding: 0.85rem;
    }

    .book-spec-item {
        gap: 0.6rem;
    }

    .book-description-card,
    .book-info-card,
    .book-comments-card,
    .book-comment-form-card {
        padding: 0.85rem;
    }

    .book-action-primary,
    .book-action-secondary {
        min-height: 44px;
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }

    .book-info-alert {
        gap: 0.65rem;
        padding: 0.85rem;
    }

    .book-alert-icon {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .book-modal-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .book-modal-stat {
        padding: 0.6rem 0.55rem;
    }

    .book-modal-stat span {
        font-size: 0.7rem;
    }

    .book-modal-stat strong {
        font-size: 0.85rem;
        line-height: 1.3;
        word-break: break-all;
    }

    .book-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.7rem;
    }

    /* Tabla disponibilidad: mostrar solo Biblioteca y Estado */
    #tablaDisponibilidad .table {
        font-size: 0.85rem;
        margin-bottom: 0;
    }

    #tablaDisponibilidad .table th,
    #tablaDisponibilidad .table td {
        padding: 0.55rem 0.6rem;
    }

    /* Ocultar columnas Total y Disponibles en móvil */
    #tablaDisponibilidad .table th:nth-child(2),
    #tablaDisponibilidad .table td:nth-child(2),
    #tablaDisponibilidad .table th:nth-child(3),
    #tablaDisponibilidad .table td:nth-child(3) {
        display: none;
    }

    /* Ejemplares: layout horizontal (icono izquierda, contenido derecha) */
    .book-copy-card {
        padding: 0.75rem;
    }

    .book-copy-card-inner {
        display: grid;
        grid-template-columns: 38px 1fr;
        grid-template-rows: auto auto auto;
        gap: 0.3rem 0.65rem;
        height: auto;
    }

    .book-copy-icon {
        grid-column: 1;
        grid-row: 1 / 4;
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
        align-self: start;
        margin-top: 0.1rem;
    }

    .book-copy-code {
        grid-column: 2;
        font-size: 0.88rem;
    }

    .book-copy-library {
        grid-column: 2;
        font-size: 0.8rem;
        line-height: 1.35;
    }

    .book-copy-status {
        grid-column: 2;
        margin-top: 0;
    }

    .book-copy-status .badge {
        font-size: 0.75rem;
        padding: 0.38rem 0.65rem;
    }

    /* Comentarios */
    .book-comment-card {
        padding: 0.75rem 0.8rem;
    }

    .book-comment-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .book-comment-date {
        font-size: 0.78rem;
    }

    .book-comment-avatar {
        width: 34px;
        height: 34px;
        font-size: 0.88rem;
    }

    .book-comment-author {
        font-size: 0.9rem;
    }

    .book-comment-stars i {
        font-size: 0.9rem;
    }

    /* Rating panel y formulario */
    .book-rating-panel {
        padding: 0.75rem;
    }

    .rating label {
        font-size: 1.8rem;
    }

    .book-comments-toggle {
        min-width: 0;
        width: 100%;
    }

    /* Info items */
    .book-info-item {
        padding: 0.7rem 0.75rem;
    }

    .book-info-item strong {
        font-size: 0.74rem;
    }

    .book-info-item span {
        font-size: 0.88rem;
    }

    .book-section-title {
        font-size: 1rem;
    }
}

/* ── Acciones en comentarios (editar / eliminar) ────────────────────────── */
.book-comment-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.book-comment-actions {
    display: flex;
    gap: 0.2rem;
    opacity: 0;
    transition: opacity 0.18s;
}

.book-comment-card:hover .book-comment-actions,
.book-comment-card:focus-within .book-comment-actions {
    opacity: 1;
}

.book-comment-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: rgba(24, 77, 59, 0.06);
    color: #4f6a61;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    padding: 0;
}

.book-comment-action-btn:hover {
    background: rgba(24, 77, 59, 0.13);
    color: #1d654c;
}

.book-comment-action-btn--danger:hover {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

/* ── Formulario de edición inline ───────────────────────────────────────── */
.book-comment-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(24, 77, 59, 0.08);
    margin-top: 0.25rem;
}

.book-comment-edit-stars {
    display: flex;
    align-items: center;
    gap: 0.18rem;
}

.book-edit-star {
    border: none;
    background: transparent;
    padding: 0.15rem;
    cursor: pointer;
    color: #cbd5ce;
    font-size: 1.15rem;
    transition: color 0.15s, transform 0.12s;
    line-height: 1;
}

.book-edit-star:hover,
.book-edit-star.is-active {
    color: #d5a437;
}

.book-edit-star:hover {
    transform: scale(1.15);
}

.book-comment-edit-textarea {
    resize: vertical;
    min-height: 80px;
    border-radius: 0.9rem;
    border-color: rgba(24, 77, 59, 0.12);
    font-size: 0.92rem;
}

.book-comment-edit-textarea:focus {
    border-color: rgba(43, 122, 93, 0.45);
    box-shadow: 0 0 0 0.18rem rgba(43, 122, 93, 0.1);
}

.book-comment-edit-actions {
    display: flex;
    gap: 0.55rem;
}

body.library-dark .book-comment-action-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #8fa4b4 !important;
}

body.library-dark .book-comment-action-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-comment-action-btn--danger:hover {
    background: rgba(248, 113, 113, 0.12) !important;
    color: #fca5a5 !important;
}

body.library-dark .book-comment-edit-form {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.library-dark .book-edit-star {
    color: rgba(255, 255, 255, 0.2) !important;
}

body.library-dark .book-edit-star:hover,
body.library-dark .book-edit-star.is-active {
    color: #e0b855 !important;
}

body.library-dark .book-comment-edit-textarea {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #edf3f8 !important;
}

body.library-dark .book-comment-edit-textarea:focus {
    border-color: rgba(216, 177, 92, 0.4) !important;
    box-shadow: 0 0 0 0.18rem rgba(216, 177, 92, 0.12) !important;
}

/* ── Badge de conteo en el botón CTA ────────────────────────────────────── */
.book-btn-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    margin-left: 0.2rem;
}

.book-action-unavailable {
    opacity: 0.58;
    cursor: not-allowed;
}

/* ── Botón compartir ────────────────────────────────────────────────────── */
.book-share-btn {
    min-width: 50px;
    justify-content: center;
    padding-inline: 0.85rem;
}

/* ── Descripción expandible ─────────────────────────────────────────────── */
.book-desc-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-desc-clamped.book-desc-expanded {
    display: block;
    -webkit-line-clamp: unset;
}

.book-desc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.3rem 0;
    background: none;
    border: none;
    color: #1d654c;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s;
}

.book-desc-toggle:hover {
    color: #0d5e47;
}

/* ── Enlace dentro del alert ────────────────────────────────────────────── */
.book-alert-link {
    color: #1d654c;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.book-alert-link:hover {
    color: #0d5e47;
}

/* ── Sticky CTA móvil ───────────────────────────────────────────────────── */
.book-sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 120;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(24, 77, 59, 0.1);
    box-shadow: 0 -8px 28px rgba(24, 77, 59, 0.12);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.book-sticky-cta.book-sticky-hidden {
    transform: translateY(110%);
    opacity: 0;
    pointer-events: none;
}

/* ── Disponibilidad: card grid ──────────────────────────────────────────── */
.book-avail-grid {
    display: grid;
    gap: 0.65rem;
}

.book-avail-card {
    border-radius: 1rem;
    border: 1px solid rgba(24, 77, 59, 0.08);
    background: rgba(24, 77, 59, 0.03);
    overflow: hidden;
    transition: border-color 0.2s;
}

.book-avail-card:hover {
    border-color: rgba(24, 77, 59, 0.16);
}

.book-avail-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
}

.book-avail-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.35rem;
}

.book-avail-dot--on {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
    animation: book-avail-pulse 2s infinite;
}

.book-avail-dot--off {
    background: #ef4444;
}

@keyframes book-avail-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
    50%       { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.05); }
}

.book-avail-info {
    flex: 1;
    min-width: 0;
}

.book-avail-name {
    font-weight: 700;
    color: #173d2f;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-avail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.book-avail-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    background: rgba(24, 77, 59, 0.08);
    color: #2a5f48;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.book-avail-pill--muted {
    background: rgba(24, 77, 59, 0.04);
    color: #6b7d76;
    font-weight: 500;
}

.book-avail-counts {
    font-size: 0.82rem;
    color: #6b7d76;
    margin-top: 0.4rem;
}

.book-avail-counts strong {
    color: #173d2f;
}

.book-avail-sep {
    margin: 0 0.3rem;
    opacity: 0.45;
}

.book-avail-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    flex-shrink: 0;
}

.book-avail-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.32rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(24, 77, 59, 0.14);
    background: rgba(24, 77, 59, 0.05);
    color: #1d654c;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.book-avail-toggle:hover {
    background: rgba(24, 77, 59, 0.12);
    border-color: rgba(24, 77, 59, 0.25);
}

.book-avail-toggle i {
    transition: transform 0.25s ease;
}

.book-avail-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* ── Listado de ejemplares dentro de la card ─────────────────────────────── */
.book-avail-copies {
    display: grid;
    gap: 0;
    border-top: 1px solid rgba(24, 77, 59, 0.08);
    background: rgba(24, 77, 59, 0.025);
    padding: 0.5rem 0.75rem;
}

.book-avail-copy {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.35rem;
    border-bottom: 1px solid rgba(24, 77, 59, 0.06);
}

.book-avail-copy:last-child {
    border-bottom: none;
}

.book-avail-copy-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    background: rgba(29, 101, 76, 0.1);
    color: #1d654c;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.book-avail-copy-body {
    flex: 1;
    min-width: 0;
}

.book-avail-copy-code {
    font-size: 0.88rem;
    font-weight: 700;
    color: #173d2f;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-avail-copy-meta {
    font-size: 0.76rem;
    color: #748a82;
    margin-top: 0.12rem;
}

/* ── Dark mode — nuevos elementos ───────────────────────────────────────── */
body.library-dark .book-sticky-cta {
    background: rgba(12, 18, 26, 0.97) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.3) !important;
}

body.library-dark .book-desc-toggle {
    color: #86e2c0 !important;
}

body.library-dark .book-desc-toggle:hover {
    color: #aff5da !important;
}

body.library-dark .book-alert-link {
    color: #86e2c0 !important;
}

body.library-dark .book-avail-card {
    border-color: rgba(255, 255, 255, 0.07) !important;
    background: rgba(255, 255, 255, 0.025) !important;
}

body.library-dark .book-avail-card:hover {
    border-color: rgba(255, 255, 255, 0.14) !important;
}

body.library-dark .book-avail-name {
    color: #f2f6fb !important;
}

body.library-dark .book-avail-counts {
    color: #8fa4b4 !important;
}

body.library-dark .book-avail-counts strong {
    color: #f2f6fb !important;
}

body.library-dark .book-avail-pill {
    background: rgba(78, 181, 145, 0.12) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-avail-pill--muted {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #8fa4b4 !important;
}

body.library-dark .book-avail-toggle {
    border-color: rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-avail-toggle:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

body.library-dark .book-avail-copies {
    border-color: rgba(255, 255, 255, 0.07) !important;
    background: rgba(0, 0, 0, 0.15) !important;
}

body.library-dark .book-avail-copy {
    border-color: rgba(255, 255, 255, 0.05) !important;
}

body.library-dark .book-avail-copy-icon {
    background: rgba(78, 181, 145, 0.12) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-avail-copy-code {
    color: #f2f6fb !important;
}

body.library-dark .book-avail-copy-meta {
    color: #8fa4b4 !important;
}

/* ── Dark mode — filas de ejemplar ─────────────────────────────────────── */
body.library-dark .book-copy-row {
    border-bottom-color: rgba(255, 255, 255, 0.05) !important;
}

body.library-dark .book-copy-row:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.library-dark .book-copy-row-icon {
    background: rgba(78, 181, 145, 0.12) !important;
    color: #86e2c0 !important;
}

body.library-dark .book-copy-row--lent .book-copy-row-icon {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #f87171 !important;
}

body.library-dark .book-copy-row--reserved .book-copy-row-icon {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #fcd34d !important;
}

body.library-dark .book-copy-row--transfer .book-copy-row-icon {
    background: rgba(156, 163, 175, 0.1) !important;
    color: #9ca3af !important;
}

body.library-dark .book-copy-row-code {
    color: #f2f6fb !important;
}

body.library-dark .book-copy-row-meta {
    color: #8fa4b4 !important;
}
