/* Modern Clean White Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #2563eb;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --card-shadow-hover: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--text-main);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.logo-text h1 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.logo-text span {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Search bar */
.search-wrapper {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 9px 16px 9px 38px;
  font-size: 13.5px;
  font-family: var(--font-sans);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--text-main);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  display: none;
}

.search-clear.active {
  display: block;
}

/* Header buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.16s ease;
  border: 1px solid transparent;
  font-family: var(--font-sans);
}

.btn-primary {
  background-color: var(--text-main);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: white;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--bg-secondary);
  border-color: var(--text-muted);
}

.btn-add-book {
  background: #2563eb;
  color: white;
}

.btn-add-book:hover {
  background: #1d4ed8;
}

/* Hero bar */
.hero-section {
  padding: 24px 0 16px;
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.hero-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 650px;
}

.stats-bar {
  display: flex;
  gap: 20px;
}

.stat-item {
  text-align: right;
}

.stat-number {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-serif);
  color: var(--text-main);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Category Filter Bar */
.category-bar {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  background-color: #ffffff;
  position: sticky;
  top: 67px;
  z-index: 90;
}

.category-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.cat-pill {
  padding: 6px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cat-pill:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
}

.cat-pill.active {
  background-color: var(--text-main);
  border-color: var(--text-main);
  color: white;
}

.cat-count {
  font-size: 10.5px;
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 10px;
}

.cat-pill.active .cat-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Main 2-Column Layout with Permanent Right Sidebar */
.layout-2col {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  padding-top: 14px;
}

.gallery-column {
  flex: 1;
  min-width: 0;
}

/* Permanent Right Recommendations Sidebar */
.recommendations-sidebar {
  width: 360px;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  position: sticky;
  top: 135px;
  max-height: calc(100vh - 150px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rec-sidebar-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
}

.rec-sidebar-title {
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rec-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Quick Recommendation Form */
.quick-rec-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

.form-group-sm {
  margin-bottom: 10px;
}

.form-label-sm {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-input-sm, .form-select-sm, .form-textarea-sm {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font-sans);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
}

.form-input-sm:focus, .form-select-sm:focus, .form-textarea-sm:focus {
  outline: none;
  border-color: var(--text-main);
}

/* Recommendation Feed Items */
.rec-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  transition: all 0.15s;
}

.rec-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.rec-book-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.rec-author {
  font-size: 12.5px;
  color: var(--text-muted);
}

.rec-meta {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 6px;
}

/* Sub toolbar (Filters & Sorting) */
.sub-toolbar {
  padding: 10px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.active-filter-indicator {
  font-size: 13.5px;
  color: var(--text-muted);
}

.active-filter-indicator strong {
  color: var(--text-main);
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-wrapper {
  position: relative;
}

.select-input {
  appearance: none;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 7px 28px 7px 10px;
  font-size: 12.5px;
  font-family: var(--font-sans);
  color: var(--text-main);
  cursor: pointer;
}

.select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 10px;
  color: var(--text-muted);
}

/* Books Grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

.book-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: #cbd5e1;
}

.cover-wrapper {
  position: relative;
  width: 100%;
  padding-top: 145%;
  background-color: #f1f5f9;
  overflow: hidden;
}

.book-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.book-card:hover .book-cover {
  transform: scale(1.04);
}

.format-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  background: rgba(15, 23, 42, 0.9);
  color: white;
}

.format-badge.pdf {
  background: rgba(185, 28, 28, 0.9);
}

.card-cover-change-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
}

.book-card:hover .card-cover-change-btn {
  opacity: 1;
  transform: translateY(0);
}

.card-cover-change-btn:hover {
  background: #0f172a;
  transform: translateY(0) scale(1.05);
}

.book-card.drag-target {
  outline: 3px dashed #2563eb !important;
  outline-offset: -3px;
  transform: scale(1.02);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.2);
}

.user-added-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #2563eb;
  color: white;
  z-index: 5;
}

.card-details {
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-category {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.book-title {
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}

.book-author {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 6px;
}

.btn-read {
  flex: 1;
  padding: 6px 10px;
  background: var(--text-main);
  color: white;
  text-align: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.15s;
}

.btn-read:hover {
  background: var(--primary-hover);
}

.btn-card-edit {
  width: 30px;
  height: 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.15s;
}

.btn-card-edit:hover {
  background: #0f172a;
  color: white;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
  transform: translateY(12px) scale(0.98);
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
}

.modal-backdrop.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
}

.form-input, .form-select {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: var(--font-sans);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--text-main);
  background: white;
}

/* Toast Notifications */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* Drag and drop overlay */
.drag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37, 99, 235, 0.1);
  border: 3px dashed #2563eb;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.drag-overlay.active {
  display: flex;
}

.drag-overlay-box {
  background: white;
  padding: 30px 40px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  text-align: center;
}

/* Floating Mobile Recommendations / Wishlist Button */
.btn-floating-recs {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 95;
  background: var(--text-main);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: var(--font-sans);
}

.btn-floating-recs:active {
  transform: scale(0.96);
}

.floating-badge {
  background: #2563eb;
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
}

.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 110;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.btn-close-mobile-sheet {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
}

.rec-sheet-pill {
  display: none;
  width: 40px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 2px;
  margin: 0 auto 12px;
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .layout-2col {
    flex-direction: column;
  }

  .btn-floating-recs {
    display: flex;
  }

  .recommendations-sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25);
    z-index: 120;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    background: white;
    padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0));
  }

  .recommendations-sidebar.mobile-open {
    transform: translateY(0);
  }

  .btn-close-mobile-sheet {
    display: block;
  }

  .rec-sheet-pill {
    display: block;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 10px 0;
  }

  .header-content {
    flex-wrap: wrap;
    gap: 8px;
  }

  .logo-area {
    gap: 8px;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  .logo-text h1 {
    font-size: 17px;
  }

  .logo-text span {
    font-size: 9px;
  }

  .search-wrapper {
    order: 3;
    width: 100%;
    max-width: 100%;
    margin-top: 2px;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .btn span {
    display: none;
  }

  .header-actions .btn {
    padding: 8px 10px;
  }

  .hero-section {
    padding: 20px 0 14px;
  }

  .hero-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .hero-title {
    font-size: 20px;
  }

  .hero-subtitle {
    font-size: 12.5px;
  }

  .stats-bar {
    width: 100%;
    justify-content: space-around;
    padding: 8px 12px;
    gap: 8px;
  }

  .stat-number {
    font-size: 18px;
  }

  .stat-label {
    font-size: 9.5px;
  }

  .category-bar {
    padding: 6px 0;
  }

  .category-scroll {
    gap: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-scroll::-webkit-scrollbar {
    display: none;
  }

  .cat-pill {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  .sub-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
  }

  .filter-controls {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
    width: 100%;
  }

  .select-input {
    width: 100%;
    font-size: 12px;
    padding: 6px 20px 6px 8px;
  }

  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .book-card {
    border-radius: var(--radius-md);
  }

  .book-card-body {
    padding: 8px 10px 10px;
  }

  .book-card-title {
    font-size: 13px;
    line-height: 1.25;
    margin-bottom: 3px;
  }

  .book-card-author {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .book-card-meta {
    margin-bottom: 6px;
  }

  .book-card-actions {
    gap: 4px;
  }

  .book-card-actions .btn {
    padding: 6px;
    font-size: 11px;
  }

  .modal-card {
    max-width: 92vw !important;
    margin: 16px auto;
  }
}

/* ==========================================================================
   Sync, Profiles & Device Management Styles
   ========================================================================== */

.btn-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 9999px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  transition: all 0.2s;
}

.sync-dot.syncing {
  background-color: #3b82f6;
  animation: pulse-sync 1.2s infinite;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.sync-dot.offline {
  background-color: #94a3b8;
  box-shadow: none;
}

@keyframes pulse-sync {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
}

.sync-banner-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
}

.status-synced {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.status-syncing {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.profile-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 600px) {
  .profile-options-grid {
    grid-template-columns: 1fr;
  }
}

.profile-card {
  position: relative;
  display: flex;
  cursor: pointer;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 12px;
  transition: all 0.18s ease;
}

.profile-card input[type="radio"] {
  position: absolute;
  top: 12px;
  right: 12px;
  accent-color: #0f172a;
}

.profile-card.active,
.profile-card:has(input[type="radio"]:checked) {
  border-color: #0f172a;
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.profile-title {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.badge-default {
  font-size: 9.5px;
  background: #0f172a;
  color: white;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.profile-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.reading-logs-container {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
}

.reading-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12.5px;
  transition: background 0.15s;
}

.reading-log-item:last-child {
  border-bottom: none;
}

.reading-log-item:hover {
  background: #f8fafc;
}

.log-device-badge {
  font-size: 10.5px;
  background: #e2e8f0;
  color: #334155;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-dupes {
  position: relative;
}

.badge-pill {
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9999px;
  padding: 1px 6px;
  margin-left: 3px;
}

/* ==========================================================================
   Duplicate Manager Styles
   ========================================================================== */

.duplicates-list-container {
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dupe-group-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--bg-surface);
}

.dupe-group-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dupe-items-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dupe-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fafafa;
}

.dupe-item-thumb {
  width: 42px;
  height: 58px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.dupe-item-details {
  flex: 1;
  min-width: 0;
}

.dupe-item-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.dupe-item-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.dupe-action-del {
  color: #ef4444;
  border-color: #fca5a5;
  font-size: 11.5px;
  padding: 5px 10px;
  white-space: nowrap;
}

.dupe-action-del:hover {
  background: #fef2f2;
}




/* Featured book: original homepage enhancement; existing category bar and grid remain unchanged. */
.featured-book-section { padding: 24px 0 10px; background: #fff; }
.featured-book-section[hidden] { display: none; }
.featured-book-panel { display: grid; grid-template-columns: minmax(0,1fr) 220px; gap: 32px; align-items: center; padding: 38px 48px; background: linear-gradient(115deg,#13283d,#203952); border-radius: 18px; color: #f8f4ec; min-height: 315px; overflow: hidden; }
.featured-book-copy { min-width: 0; }
.featured-book-eyebrow { display: block; color: #dfbb80; font-size: 11px; letter-spacing: .17em; font-weight: 700; margin-bottom: 14px; }
.featured-book-category { display: block; font-size: 12px; color: #e0caac; margin-bottom: 6px; }
.featured-book-copy h2 { font: 700 clamp(27px,3.6vw,43px)/1.12 var(--font-serif,Georgia,serif); max-width: 640px; color: #fff; margin: 0 0 10px; }
.featured-book-byline { font-size: 14px; color: #e3d8c8; margin-bottom: 14px; }
.featured-book-description { font-size: 14px; line-height: 1.65; color: #d6dce2; max-width: 590px; margin-bottom: 22px; }
.featured-book-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.featured-book-read { display: inline-flex; padding: 11px 19px; border-radius: 8px; background: #e4bc7f; color: #1c2b3c; font-size: 13px; font-weight: 750; text-decoration: none; }
.featured-book-read:hover { background: #f2d2a1; }
.featured-book-next { color: #f2e9d8; background: transparent; border: 1px solid #8291a1; border-radius: 8px; padding: 10px 15px; cursor: pointer; font: inherit; font-size: 13px; }
.featured-book-next:hover { background: #ffffff16; }
.featured-book-art { display: flex; justify-content: center; }
.featured-book-art img { display: block; width: min(100%,190px); max-height: 270px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; box-shadow: 12px 20px 28px #0006; background: #34495c; }
@media (max-width: 700px) { .featured-book-section { padding-top: 12px; } .featured-book-panel { grid-template-columns: minmax(0,1fr) 105px; gap: 12px; padding: 24px 18px; min-height: 220px; border-radius: 12px; } .featured-book-eyebrow { font-size: 9px; margin-bottom: 8px; } .featured-book-copy h2 { font-size: clamp(20px,5vw,28px); } .featured-book-description { font-size: 12px; line-height: 1.5; margin-bottom: 14px; } .featured-book-byline { font-size: 12px; margin-bottom: 8px; } .featured-book-art img { max-height: 175px; } .featured-book-actions { gap: 8px; } .featured-book-read,.featured-book-next { font-size: 11px; padding: 8px 9px; } }
@media (max-width: 380px) { .featured-book-panel { grid-template-columns: 1fr 84px; } .featured-book-art img { max-height: 145px; } }
