/* ===== v7: biblioteca con portadas, Continuar, mini-player, carpetas, estadísticas ===== */
.user-name { font-size: 0.85rem; color: #60a5fa; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout { padding: 6px 10px !important; font-size: 0.8rem !important; background: rgba(239,68,68,.2) !important; color: #f87171 !important; border-color: rgba(239,68,68,.4) !important; }
.section-sub { color: var(--text-secondary); font-size: 0.9rem; }
.small-label { font-size: 0.8rem; color: var(--text-secondary); display: block; margin-bottom: 4px; }
.hint { color: var(--text-muted); font-size: 0.78rem; display: block; margin-top: 6px; line-height: 1.4; }
.ver { font-size: .65rem; opacity: .5; font-weight: 400; }
.btn-wide { width: 100%; justify-content: center; }
main { padding-bottom: 24px; }
body.has-mini main { padding-bottom: 96px; }

.block-title { font-size: 1.05rem; font-weight: 700; margin: 4px 0 10px; }

/* Continuar */
.shelf { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.shelf::-webkit-scrollbar { display: none; }
.shelf-card { flex: 0 0 104px; cursor: pointer; }
.shelf-card .cover { width: 104px; height: 150px; }
.shelf-card .shelf-title { font-size: .8rem; margin-top: 6px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.shelf-card .shelf-pct { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

/* Portadas */
.cover { position: relative; border-radius: 8px; overflow: hidden; background: var(--bg-surface-elevated); border: 1px solid var(--border); flex-shrink: 0; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-ph { display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px; font-weight: 700; color: #fff; font-size: .8rem; line-height: 1.2; word-break: break-word; }
.cover-badge { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: .65rem; padding: 1px 6px; border-radius: 10px; }

/* Buscador y carpetas */
.library-tools { margin: 6px 0 10px; }
.search-input { width: 100%; padding: 10px 14px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; color: #fff; font-size: .95rem; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; background: var(--bg-surface-elevated); border: 1px solid var(--border); color: var(--text-secondary); padding: 8px 14px; border-radius: 20px; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip-add { border-style: dashed; }

/* Lista de libros */
.book-list { display: flex; flex-direction: column; gap: 4px; }
.book-row { display: flex; align-items: center; gap: 14px; padding: 10px 6px; border-bottom: 1px solid var(--border); cursor: pointer; }
.book-row:active { background: rgba(255,255,255,.03); }
.book-row .cover { width: 62px; height: 88px; }
.book-info { flex: 1; min-width: 0; }
.book-row .book-title { font-size: 1rem; font-weight: 600; margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.book-row .book-meta { font-size: .8rem; color: var(--text-secondary); margin: 0 0 6px; }
.book-row .progress-bar-bg { height: 4px; margin: 0; }
.book-status { font-size: .8rem; margin-top: 4px; }
.book-status.proc { color: #fbbf24; }
.book-status.err { color: #f87171; }
.btn-more { background: transparent; border: none; color: var(--text-secondary); font-size: 1.4rem; padding: 8px 10px; cursor: pointer; border-radius: 8px; line-height: 1; }
.empty-state { text-align: center; padding: 40px 10px; color: var(--text-muted); }

/* Mini reproductor */
.mini-player { position: fixed; left: 8px; right: 8px; bottom: 8px; background: var(--bg-surface-elevated); border: 1px solid var(--border); border-radius: 16px; display: flex; align-items: center; gap: 6px; padding: 8px 10px; z-index: 150; box-shadow: 0 8px 30px rgba(0,0,0,.5); max-width: 884px; margin: 0 auto; }
.mini-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.mini-cover { width: 40px; height: 52px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--bg-primary); }
.mini-cover-ph { display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.mini-text { min-width: 0; }
.mini-title { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-btn { background: transparent; border: none; color: var(--text-primary); font-size: 1.5rem; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; }
.mini-play { background: var(--accent); font-size: 1.1rem; }

/* Reproductor */
.player-title-row { display: flex; gap: 14px; align-items: center; }
.player-cover { width: 64px; height: 92px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); flex-shrink: 0; }
.player-book-info { min-width: 0; text-align: left; }
.player-book-info h2 { word-break: break-word; }
.btn-secondary-action { flex-direction: column; line-height: 1; gap: 2px; font-size: 1.25rem; }
.btn-secondary-action small { font-size: .62rem; font-weight: 700; }
.btn-tiny { width: 40px; height: 40px; background: transparent; color: var(--text-secondary); font-size: 1.1rem; border: 1px solid var(--border); }
.playback-buttons { gap: 12px; }
.sleep-left { font-size: .78rem; color: #fbbf24; min-width: 40px; }

/* Importar */
.import-tabs-4 .tab-btn { padding: 8px 4px; font-size: .78rem; }
.big-textarea { width: 100%; min-height: 150px; padding: 10px 12px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px; color: #fff; font-size: .95rem; font-family: inherit; resize: vertical; }
.input-group input[type=file] { padding: 8px; }
.scan-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.btn-secondary-wide { flex: 1; text-align: center; background: var(--bg-surface-elevated); border: 1px solid var(--border); color: var(--text-primary); padding: 12px 8px; border-radius: 10px; cursor: pointer; font-size: .9rem; }
.scan-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; max-height: 150px; overflow-y: auto; }
.scan-thumb { position: relative; width: 56px; height: 72px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.scan-thumb img { width: 100%; height: 100%; object-fit: cover; }
.scan-thumb button { position: absolute; top: 0; right: 0; background: rgba(0,0,0,.7); color: #fff; border: none; width: 20px; height: 20px; font-size: .7rem; cursor: pointer; }
.import-status { font-size: .88rem; margin-top: 12px; line-height: 1.4; }
.modal-box { max-height: 92vh; overflow-y: auto; }

/* Estadísticas */
.stat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-card { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.stat-num { font-size: 1.35rem; font-weight: 700; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar { width: 100%; background: linear-gradient(180deg, #3b82f6, #10b981); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.bar.today { box-shadow: 0 0 10px var(--accent-glow); }
.bar-day { font-size: .7rem; color: var(--text-muted); }
.bar-val { font-size: .62rem; color: var(--text-secondary); }

/* Hojas de acciones y diálogos propios */
.sheet-overlay { align-items: flex-end; z-index: 300; }
.sheet-box { max-width: 520px; border-radius: 20px 20px 0 0; padding: 18px 18px 24px; }
.sheet-title { font-size: 1.05rem; margin-bottom: 10px; word-break: break-word; }
.sheet-text { color: var(--text-secondary); font-size: .92rem; margin-bottom: 12px; line-height: 1.4; }
.sheet-input { width: 100%; padding: 12px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px; color: #fff; font-size: 1rem; margin-bottom: 12px; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }
.sheet-btn { background: var(--bg-surface-elevated); border: 1px solid var(--border); color: var(--text-primary); padding: 14px; border-radius: 12px; font-size: 1rem; cursor: pointer; text-align: left; }
.sheet-btn.primary { background: var(--accent); border-color: var(--accent); text-align: center; font-weight: 600; }
.sheet-btn.danger { color: #f87171; }
.sheet-btn.cancel { text-align: center; color: var(--text-secondary); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #0f172a; color: #fff; border: 1px solid var(--border); padding: 10px 16px; border-radius: 12px; font-size: .9rem; z-index: 400; max-width: 90%; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.5); }

/* Encabezado y botones en pantallas angostas */
.logo span { white-space: nowrap; }
.btn-primary { white-space: nowrap; }
@media (max-width: 430px) {
  header { padding: 12px 12px; gap: 6px; }
  .logo { font-size: 1rem; gap: 8px; }
  .logo-badge { width: 28px; height: 28px; }
  nav button { padding: 7px 10px; }
  .user-name { max-width: 64px; font-size: .78rem; }
  main { padding: 14px; }
  .section-title { font-size: 1.25rem; }
}

.btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
