*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #e0e7ff;
  --bg: #f8f9ff;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 200;
  transition: transform .25s ease;
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 24px; }
.logo-text { font-size: 18px; font-weight: 700; color: var(--primary); flex: 1; }
.sidebar-close { display: none; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }

.nav-links { list-style: none; padding: 12px 8px; flex: 1; }
.nav-links li { margin-bottom: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; text-decoration: none;
  color: var(--text-muted); font-size: 15px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--primary-light); color: var(--primary); }
.nav-icon { font-size: 18px; }

/* ── OVERLAY ── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 150; }
.overlay.show { display: block; }

/* ── MAIN ── */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

/* ── TOPBAR ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.menu-btn { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }
.page-title { font-size: 18px; font-weight: 700; flex: 1; }
.add-btn {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.add-btn:hover { background: var(--primary-dark); }

/* ── PAGE ── */
.page { display: none; padding: 20px; flex: 1; }
.page.active { display: block; }

/* ── TOOLBAR ── */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px;
}
.search-input {
  flex: 1; min-width: 180px; padding: 9px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; background: var(--surface);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.filter-select, .sort-select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--surface); cursor: pointer; outline: none;
}
.filter-select:focus, .sort-select:focus { border-color: var(--primary); }
.view-toggle { display: flex; gap: 4px; }
.view-btn {
  padding: 8px 10px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; cursor: pointer; font-size: 16px; color: var(--text-muted);
  transition: all .15s;
}
.view-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.export-btn {
  padding: 9px 14px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--text-muted);
  font-weight: 500; transition: all .15s; white-space: nowrap;
}
.export-btn:hover { border-color: var(--primary); color: var(--primary); }

.book-count { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

/* ── BOOKS GRID ── */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.books-grid.list-view { grid-template-columns: 1fr; }

/* ── BOOK CARD ── */
.book-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s;
  position: relative;
}
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.book-cover {
  width: 100%; aspect-ratio: 2/3; object-fit: cover; background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center; font-size: 48px;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover-placeholder { width: 100%; aspect-ratio: 2/3; background: linear-gradient(135deg, #667eea22, #764ba222); display: flex; align-items: center; justify-content: center; font-size: 48px; }

.book-info { padding: 10px; }
.book-title { font-size: 13px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.book-author { font-size: 12px; color: var(--text-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.book-year { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.status-badge {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.status-read { background: #d1fae5; color: #065f46; }
.status-reading { background: #fef3c7; color: #92400e; }
.status-unread { background: #f3f4f6; color: #374151; }

.wish-badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 16px; background: rgba(255,255,255,.9); border-radius: 50%; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
}

.book-rating { font-size: 12px; color: #f59e0b; margin-top: 4px; }

/* LIST VIEW CARD */
.books-grid.list-view .book-card { display: flex; flex-direction: row; height: 100px; }
.books-grid.list-view .book-cover-placeholder { width: 70px; min-width: 70px; aspect-ratio: unset; height: 100%; font-size: 28px; border-radius: 0; }
.books-grid.list-view .book-cover { width: 70px; min-width: 70px; aspect-ratio: unset; height: 100%; }
.books-grid.list-view .book-info { display: flex; flex-direction: column; justify-content: center; flex: 1; padding: 12px 16px; }
.books-grid.list-view .book-title { -webkit-line-clamp: 1; font-size: 15px; }
.books-grid.list-view .status-badge { top: auto; left: auto; position: static; display: inline-block; margin-top: 6px; }
.books-grid.list-view .wish-badge { top: 8px; right: 8px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state p { font-size: 16px; margin-bottom: 8px; }
.empty-sub { font-size: 13px; }
.empty-state .add-btn { margin-top: 16px; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px; text-align: center;
}
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 800; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-card.blue .stat-value { color: #4f46e5; }
.stat-card.green .stat-value { color: #059669; }
.stat-card.orange .stat-value { color: #d97706; }
.stat-card.gray .stat-value { color: #6b7280; }
.stat-card.purple .stat-value { color: #7c3aed; }
.stat-card.teal .stat-value { color: #0891b2; }

.stats-section { margin-bottom: 28px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stats-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.bar-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { width: 140px; font-size: 13px; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex-shrink: 0; }
.bar-track { flex: 1; background: var(--bg); border-radius: 20px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; background: var(--primary); transition: width .5s ease; }
.bar-count { font-size: 12px; color: var(--text-muted); width: 24px; text-align: right; }

/* ── MODAL ── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 500; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  animation: slideUp .2s ease;
}
.modal-detail { max-width: 640px; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--surface); z-index: 1;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); }

/* TABS */
.modal-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 12px; }
.tab-btn {
  padding: 12px 14px; background: none; border: none; border-bottom: 2px solid transparent;
  font-size: 14px; font-weight: 500; cursor: pointer; color: var(--text-muted);
  transition: all .15s; white-space: nowrap;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--text); }

.tab-content { display: none; padding: 20px; }
.tab-content.active { display: block; }

/* SEARCH TAB */
.search-row { display: flex; gap: 8px; margin-bottom: 16px; }
.search-row input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; }
.search-row input:focus { border-color: var(--primary); }
.search-go-btn {
  padding: 10px 18px; background: var(--primary); color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.search-go-btn:hover { background: var(--primary-dark); }

.search-results { display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; }
.result-item {
  display: flex; gap: 12px; padding: 10px; border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: background .15s;
}
.result-item:hover { background: var(--bg); }
.result-thumb { width: 48px; min-width: 48px; height: 70px; border-radius: 6px; object-fit: cover; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; }
.result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.result-info { flex: 1; }
.result-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.result-author { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.result-year { font-size: 11px; color: var(--text-muted); }
.result-add-btn {
  align-self: center; padding: 6px 12px; background: var(--primary); color: #fff;
  border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.result-add-btn:hover { background: var(--primary-dark); }
.search-loading { text-align: center; padding: 20px; color: var(--text-muted); font-size: 14px; }
.search-empty { text-align: center; padding: 20px; color: var(--text-muted); font-size: 14px; }

/* SCAN */
.scan-area { text-align: center; }
#qr-reader { max-width: 100%; border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.scan-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
#scanResult { font-size: 14px; color: var(--primary); font-weight: 600; }

/* FORM */
.form-row { display: flex; gap: 12px; }
.form-row.two-col > * { flex: 1; }
.form-group { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; background: var(--surface); font-family: inherit;
  transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group textarea { resize: vertical; }
.checkbox-group label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.checkbox-group input { width: auto; }

.star-rating { display: flex; gap: 4px; cursor: pointer; }
.star { font-size: 24px; color: #d1d5db; transition: color .1s; }
.star.active { color: #f59e0b; }
.star:hover { color: #f59e0b; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.btn-primary { padding: 10px 24px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { padding: 10px 20px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; cursor: pointer; }
.btn-secondary:hover { background: var(--border); }

/* DETAIL MODAL */
.detail-body { padding: 20px; }
.detail-top { display: flex; gap: 20px; margin-bottom: 20px; }
.detail-cover { width: 120px; min-width: 120px; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.detail-cover img { width: 100%; display: block; }
.detail-cover-placeholder { width: 120px; height: 180px; background: linear-gradient(135deg, #667eea33, #764ba233); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 48px; }
.detail-meta { flex: 1; }
.detail-title { font-size: 20px; font-weight: 800; margin-bottom: 6px; line-height: 1.3; }
.detail-author { font-size: 15px; color: var(--text-muted); margin-bottom: 12px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.detail-tag { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--primary-light); color: var(--primary); }
.detail-stars { font-size: 20px; color: #f59e0b; margin-bottom: 8px; }
.detail-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.detail-props { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.detail-prop { font-size: 13px; }
.detail-prop span:first-child { color: var(--text-muted); display: block; }
.detail-prop span:last-child { font-weight: 600; }
.detail-prop-location { grid-column: 1 / -1; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 8px 12px; }
.detail-prop-location span:first-child { color: #15803d; font-size: 12px; }
.detail-prop-location span:last-child { color: #166534; font-size: 14px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-actions button { padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--surface); transition: all .15s; }
.detail-actions button:hover { background: var(--bg); }
.detail-edit-btn { background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important; }
.detail-delete-btn { color: #ef4444 !important; border-color: #fecaca !important; }
.detail-delete-btn:hover { background: #fef2f2 !important; }
.detail-wish-btn.active { color: #ef4444 !important; border-color: #fecaca !important; }

/* ── LOCATION QR (FORM) ── */
.location-qr-wrap {
  display: flex; align-items: center; gap: 14px;
  margin-top: 10px; padding: 12px; background: #f8fafc;
  border: 1px dashed var(--border); border-radius: 10px;
}
.location-qr-wrap canvas { border-radius: 6px; flex-shrink: 0; }
.qr-actions { display: flex; flex-direction: column; gap: 6px; }
.qr-hint { font-size: 12px; color: var(--text-muted); }
.qr-print-btn {
  padding: 6px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 500;
  transition: all .15s; width: fit-content;
}
.qr-print-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── LOCATION SCAN RESULT ── */
.location-scan-result {
  margin-top: 16px; border: 1px solid #bbf7d0; border-radius: 12px;
  background: #f0fdf4; overflow: hidden;
}
.location-scan-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid #bbf7d0; background: #dcfce7;
}
.location-scan-icon { font-size: 22px; }
.location-scan-title { font-size: 15px; font-weight: 700; color: #166534; }
.location-scan-sub { font-size: 12px; color: #16a34a; margin-top: 2px; }
.location-book-item {
  display: flex; flex-direction: column; padding: 12px 16px;
  border-bottom: 1px solid #bbf7d0; cursor: pointer; transition: background .15s;
}
.location-book-item:last-child { border-bottom: none; }
.location-book-item:hover { background: #dcfce7; }
.location-book-title { font-size: 14px; font-weight: 600; color: #14532d; }
.location-book-author { font-size: 12px; color: #16a34a; }
.location-empty { padding: 16px; color: #16a34a; font-size: 13px; text-align: center; }

/* ── DETAIL QR ── */
.detail-qr-section {
  display: flex; align-items: center; gap: 16px;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; margin-bottom: 16px;
}
.detail-qr-section canvas { border-radius: 6px; flex-shrink: 0; }
.detail-qr-left { flex-shrink: 0; }
.detail-qr-right { display: flex; flex-direction: column; gap: 4px; }
.detail-qr-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.detail-qr-loc { font-size: 14px; font-weight: 700; color: var(--text); }
.detail-qr-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.detail-qr-print-btn, .detail-qr-dl-btn {
  padding: 6px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all .15s;
}
.detail-qr-print-btn:hover { border-color: var(--primary); color: var(--primary); }
.detail-qr-dl-btn:hover { border-color: #059669; color: #059669; }

/* ── DETAIL SECTIONS (quotes / notes) ── */
.detail-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 16px; overflow: hidden;
}
.detail-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.detail-section-title { font-size: 14px; font-weight: 700; color: var(--text); }
.detail-section-add-btn {
  padding: 5px 12px; background: var(--primary); color: #fff;
  border: none; border-radius: 6px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.detail-section-add-btn:hover { background: var(--primary-dark); }
.detail-section-add-btn.secondary {
  background: var(--surface); color: var(--primary);
  border: 1px solid var(--primary);
}
.detail-section-add-btn.secondary:hover { background: var(--primary-light); }

.detail-empty-hint { padding: 14px 16px; font-size: 13px; color: var(--text-muted); }

.detail-add-form { padding: 14px 16px; border-top: 1px solid var(--border); background: #fafafa; }
/* Google Lens row */
.lens-row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.lens-btn, a.lens-btn {
  padding: 7px 14px; background: #4285f4; color: #fff !important; border: none;
  border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center;
}
.lens-btn:hover, a.lens-btn:hover { background: #3367d6; }
.lens-paste-btn {
  padding: 7px 14px; background: var(--surface); color: var(--primary);
  border: 1.5px solid var(--primary); border-radius: 7px; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.lens-paste-btn:hover { background: var(--primary-light); }
.lens-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.detail-add-form textarea,
.detail-add-form input[type=number],
.detail-add-form input[type=text],
.detail-add-form select {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; font-family: inherit; background: var(--surface);
  margin-bottom: 8px;
}
.detail-add-form textarea:focus,
.detail-add-form input:focus,
.detail-add-form select:focus { border-color: var(--primary); }
.detail-add-form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.detail-add-form-row input { width: auto !important; flex: 1; min-width: 80px; margin-bottom: 0; }
.detail-add-form-row select { width: auto !important; flex: 1; margin-bottom: 0; }
.detail-add-save-btn {
  padding: 7px 16px; background: var(--primary); color: #fff; border: none;
  border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.detail-add-save-btn:hover { background: var(--primary-dark); }
.detail-add-cancel-btn {
  padding: 7px 12px; background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 7px; font-size: 13px; cursor: pointer;
}

/* QUOTE ITEMS */
.quote-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-start;
}
.quote-item:last-child { border-bottom: none; }
.quote-body { flex: 1; }
.quote-text {
  font-size: 14px; line-height: 1.6; color: var(--text);
  font-style: italic; margin-bottom: 6px;
}
.quote-text::before { content: '"'; color: var(--primary); font-size: 18px; font-style: normal; }
.quote-text::after  { content: '"'; color: var(--primary); font-size: 18px; font-style: normal; }
.quote-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.quote-page { font-size: 11px; color: var(--text-muted); }
.quote-tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--primary-light); color: var(--primary);
}
.quote-tag.tag-favori    { background: #fef3c7; color: #92400e; }
.quote-tag.tag-önemli    { background: #fee2e2; color: #991b1b; }
.quote-tag.tag-ilham     { background: #d1fae5; color: #065f46; }
.quote-tag.tag-düşündürücü { background: #ede9fe; color: #5b21b6; }
.item-delete-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 14px; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; line-height: 1;
}
.item-delete-btn:hover { background: #fee2e2; color: #ef4444; }

/* NOTE ITEMS */
.note-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.note-item:last-child { border-bottom: none; }
.note-text-content { font-size: 14px; line-height: 1.6; white-space: pre-wrap; margin-bottom: 6px; }
.note-photo-img { width: 100%; max-width: 340px; border-radius: 8px; display: block; margin-bottom: 6px; }
.note-item-footer { display: flex; justify-content: space-between; align-items: center; }
.note-date { font-size: 11px; color: var(--text-muted); }

/* Reading dates in detail-props */
.detail-prop-dates { grid-column: 1 / -1; display: flex; gap: 16px; flex-wrap: wrap; }
.detail-date-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--primary-light); border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--primary);
}

/* ── SHELVES PAGE ── */
.shelf-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.shelf-print-all-btn {
  padding: 9px 16px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text-muted); transition: all .15s;
}
.shelf-print-all-btn:hover { border-color: var(--primary); color: var(--primary); }

.shelves-grid { display: flex; flex-direction: column; gap: 12px; }

.shelf-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px; padding: 14px 16px;
}
.shelf-qr-col { flex-shrink: 0; }
.shelf-info-col { flex: 1; min-width: 0; }
.shelf-card-name { font-size: 17px; font-weight: 800; color: var(--text); margin-bottom: 3px; }
.shelf-card-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.shelf-card-count { font-size: 12px; color: var(--primary); font-weight: 600; }
.shelf-card-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.shelf-act-btn {
  padding: 6px 10px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; font-size: 14px; cursor: pointer; transition: all .15s;
  line-height: 1;
}
.shelf-act-btn:hover { background: var(--bg); }
.shelf-act-btn.danger:hover { background: #fef2f2; border-color: #fecaca; }

@media (max-width: 480px) {
  .shelf-card { flex-wrap: wrap; }
  .shelf-card-actions { flex-direction: row; width: 100%; }
}

/* ── SYNC PAGE ── */
.sync-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.sync-card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.sync-steps { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--text); margin-bottom: 16px; }
.sync-steps a { color: var(--primary); }
.code-block-wrap { margin-top: 8px; }
.code-block-wrap summary { font-size: 13px; font-weight: 600; color: var(--primary); cursor: pointer; padding: 6px 0; }
.code-block {
  background: #1e1e1e; color: #d4d4d4; border-radius: 8px; padding: 14px;
  font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre;
  margin: 10px 0 8px; font-family: 'Courier New', monospace; max-height: 280px; overflow-y: auto;
}
.copy-code-btn {
  padding: 7px 16px; background: var(--primary); color: #fff; border: none;
  border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.copy-code-btn:hover { background: var(--primary-dark); }
.sync-url-row { display: flex; gap: 8px; margin-bottom: 8px; }
.sync-url-row input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none;
}
.sync-url-row input:focus { border-color: var(--primary); }
.sync-save-btn {
  padding: 9px 16px; background: var(--primary); color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.sync-save-btn:hover { background: var(--primary-dark); }
.sync-url-status { font-size: 13px; min-height: 18px; }
.sync-controls { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.sync-import-btn {
  padding: 11px 22px; background: var(--surface); color: #059669;
  border: 2px solid #059669; border-radius: 9px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all .15s; width: fit-content;
}
.sync-import-btn:hover { background: #f0fdf4; }
.sync-import-btn:disabled { opacity: .5; cursor: not-allowed; }
.sync-now-btn {
  padding: 11px 22px; background: #059669; color: #fff; border: none;
  border-radius: 9px; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s; width: fit-content;
}
.sync-now-btn:hover { background: #047857; }
.sync-now-btn:disabled { background: #6ee7b7; cursor: not-allowed; }
.sync-auto-row { display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.sync-auto-row select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--surface); outline: none; cursor: pointer;
}
.sync-auto-row select:focus { border-color: var(--primary); }
.sync-status-box {
  background: var(--bg); border-radius: 8px; padding: 12px 16px;
  font-size: 13px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px;
}

/* TOAST */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #1f2937; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500; z-index: 1000; pointer-events: none;
  transition: transform .3s ease, opacity .3s ease; opacity: 0;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .topbar { padding: 0 12px; }
  .page { padding: 12px; }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
  .toolbar { gap: 8px; }
  .form-row.two-col { flex-direction: column; }
  .detail-top { flex-direction: column; }
  .detail-cover, .detail-cover-placeholder { width: 100px; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .modal-tabs .tab-btn { padding: 10px 10px; font-size: 13px; }
}
