/* ─── Bookbomi — Modern Design 2026 ─── */

:root {
  /* Light (default) */
  --bg:           #FBF8ED;
  --bg-2:         #f0ecdc;
  --surface:      #ffffff;
  --surface-2:    #f5f1e3;
  --border:       #ddd8c4;
  --text:         #1a1d24;
  --text-muted:   #6b7280;
  --text-light:   #a8b0bc;
  --accent:       #4A8AB6;        /* Hauptfarbe — dunkles Blau */
  --accent-2:     #7EBEC5;        /* Nebenelement — helles Blau */
  --accent-3:     #E2B53E;        /* Nebenelement — Gelb */
  --error:        #c0392b;
  --success:      #27ae60;
  --radius:       10px;
  --radius-lg:    16px;
  --sidebar-w:    230px;
  --shadow:       0 1px 4px rgba(74,138,182,0.08), 0 4px 16px rgba(74,138,182,0.06);
  --shadow-hover: 0 4px 12px rgba(74,138,182,0.15), 0 12px 32px rgba(74,138,182,0.10);
  --transition:   180ms ease;
}


[data-theme="dark"] #sidebar { background: var(--surface); }

[data-theme="dark"] {
  --bg:           #141820;
  --bg-2:         #1a1f2b;
  --surface:      #1f2533;
  --surface-2:    #252c3c;
  --border:       #2e3a4e;
  --text:         #e8edf5;
  --text-muted:   #7a8a9e;
  --text-light:   #4a5a6e;
  --accent:       #6aaad4;
  --accent-2:     #7EBEC5;
  --accent-3:     #E2B53E;
  --shadow:       0 1px 4px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.4), 0 12px 32px rgba(0,0,0,0.3);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ─── Layout ─── */
#app { display: flex; min-height: 100dvh; }

/* ─── Sidebar ─── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #F8F8F9;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: block;
  padding: 1.75rem 1.5rem 1.5rem;
  color: inherit;
  text-decoration: none;
}
.sidebar-logo:hover {
  color: inherit;
}
.sidebar-logo-mark {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.sidebar-logo-img {
  height: 64px;
  width: auto;
  object-fit: contain;
  object-position: left center;
}
.sidebar-logo-dark { display: none; }
[data-theme="dark"] .sidebar-logo-light { display: none; }
[data-theme="dark"] .sidebar-logo-dark { display: block; }
.sidebar-logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 1px;
}

#sidebar nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}
#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
  transition: all var(--transition);
  position: relative;
  margin-bottom: 2px;
}
#sidebar nav a:hover {
  color: var(--text);
  background: var(--bg-2);
  text-decoration: none;
}
#sidebar nav a.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 500;
}
#sidebar nav a .nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  flex-shrink: 0;
}
#sidebar nav a.active .nav-icon { opacity: 1; }
#sidebar nav a .badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}
.sidebar-username {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer-links {
  display: flex;
  gap: 1rem;
}
.sidebar-footer-links a,
.sidebar-footer-links button {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color var(--transition);
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.sidebar-footer-links a:hover,
.sidebar-footer-links button:hover { color: var(--text); }

/* ─── Main Content ─── */
#main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2.5rem;
  min-width: 0;
  /* kein max-width hier — handled per breakpoint */
}

/* ─── Page Header ─── */
.page-header {
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.15;
}
.page-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.2rem;
}

/* ─── Profil ─── */
.profile-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 480px;
}
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}
.profile-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.2rem;
  letter-spacing: -0.02em;
}
.profile-handle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}
.profile-email {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
}
.profile-member-since {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}
.profile-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.profile-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1rem;
}
.profile-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.profile-actions .btn { flex: 1; min-width: 140px; }
.profile-section-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}
.profile-shares-empty {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}
.profile-share-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.profile-share-url {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.profile-share-url input { flex: 1; font-size: 0.8rem; }
.profile-share-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.notes-text {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

/* ─── Shared (Gast-Ansicht) ─── */
#shared-app {
  min-height: 100vh;
  background: var(--bg);
}
.shared-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 2rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: #F8F8F9;
  position: sticky;
  top: 0;
  z-index: 100;
}
[data-theme="dark"] .shared-header {
  background: var(--surface);
}
.shared-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.shared-logo:hover {
  color: inherit;
}
.shared-logo-img {
  height: 64px;
  width: auto;
  object-fit: contain;
  object-position: left center;
}
.shared-logo-dark { display: none; }
[data-theme="dark"] .shared-logo-light { display: none; }
[data-theme="dark"] .shared-logo-dark { display: block; }
.shared-header-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
  display: flex;
  align-items: center;
}
.shared-header-search {
  flex: 1;
  min-width: 160px;
  max-width: 280px;
  margin-left: auto;
}
.shared-header-search input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.5rem 0.75rem 0.5rem 2rem;
  font-size: 0.875rem;
  width: 100%;
  outline: none;
  height: 38px;
}
.shared-header-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent);
}
#shared-main {
  padding: 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ─── Goal Widget ─── */
.goal-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}
.goal-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.goal-widget-header h3 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.goal-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.goal-bar-track {
  height: 5px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.goal-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.goal-pacing { font-size: 0.8rem; color: var(--text-muted); }
.goal-pacing .on-track { color: var(--success); font-weight: 500; }
.goal-pacing .behind   { color: var(--error);   font-weight: 500; }

/* ─── Toolbar ─── */
.toolbar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.toolbar-search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}
.toolbar input[type="search"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem 0.85rem 0.55rem 2.25rem;
  font-size: 0.875rem;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  height: 40px;
}
.toolbar input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.toolbar input[type="search"]::placeholder { color: var(--text-light); }
.toolbar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0 0.85rem;
  font-size: 0.8125rem;
  height: 40px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}
.toolbar select:focus { border-color: var(--accent); }
.toolbar select option { background: var(--surface); color: var(--text); }

.view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; height: 40px; }
.view-toggle button {
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface);
  transition: all var(--transition);
  height: 100%;
}
.view-toggle button + button { border-left: 1px solid var(--border); }
.view-toggle button.active { background: var(--accent); color: #fff; }

/* ─── Book Grid ─── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.25rem;
}

/* ─── Book Card ─── */
.book-card { cursor: pointer; }

.book-cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.book-card:hover .book-cover-wrap {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-hover);
}
.book-cover-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}
img.loading-img { opacity: 0; }
img.loaded-img  { opacity: 1; }

/* Skeleton shimmer */
.book-skeleton .book-cover-wrap {
  background: linear-gradient(90deg,
    var(--surface-2) 25%,
    var(--border) 50%,
    var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Placeholder when no cover — matches warm card style */
.book-cover-placeholder {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 0.7rem;
  background: linear-gradient(170deg,
    #ddeaf4 0%,
    #c8daea 100%);
  text-align: center;
}
[data-theme="dark"] .book-cover-placeholder {
  background: linear-gradient(170deg, #1e2d3d 0%, #172233 100%);
}
.book-cover-placeholder .ph-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
  hyphens: auto;
  letter-spacing: -0.01em;
}
.book-cover-placeholder .ph-author {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.3;
}

/* Format Pill */
.format-badge {
  position: absolute;
  bottom: 7px;
  right: 7px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.format-badge.paperback { background: rgba(180,140,80,0.85); color: #fff; }
.format-badge.hardcover { background: rgba(70,140,160,0.85); color: #fff; }
.format-badge.ebook     { background: rgba(70,160,140,0.85); color: #fff; }
.format-badge.audiobook { background: rgba(160,100,70,0.85); color: #fff; }

/* Rating */
.rating-dots { display: flex; gap: 3px; margin-top: 0.45rem; }
.rating-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border);
  transition: background var(--transition);
}
.rating-dots span.filled { background: var(--accent-3); }

.book-title {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.5rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  letter-spacing: -0.01em;
}
.book-author {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* ─── List View ─── */
.book-list { display: flex; flex-direction: column; gap: 2px; }
.book-list-item {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  border: 1px solid transparent;
}
.book-list-item:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: translateX(2px);
}
.book-list-cover {
  width: 46px;
  height: 68px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--surface-2);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.book-list-info h3 { font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; }
.book-list-info p  { font-size: 0.8rem; color: var(--text-muted); margin-top: 1px; }
.book-list-meta { text-align: right; font-size: 0.75rem; color: var(--text-muted); }

/* ─── Book Detail ─── */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  cursor: pointer;
  transition: color var(--transition);
  padding: 0;
  background: none;
  border: none;
}
.detail-back:hover { color: var(--text); }

.book-detail {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  max-width: 900px;
}
.cover-upload-trigger {
  cursor: pointer;
  position: relative;
}
.cover-upload-trigger::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(0,0,0,0.03);
  opacity: 0;
  transition: opacity var(--transition);
}
.cover-upload-trigger:hover::after { opacity: 1; }
.book-detail-cover-wrap {
  position: sticky;
  top: 1.5rem;
}
.book-detail-cover-wrap .book-cover-wrap {
  flex-shrink: 0;
}
.book-detail-cover-wrap .book-cover-wrap img {
  object-fit: contain;
  object-position: center;
}
.book-detail-cover {
  width: 200px;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
}
.book-detail-cover-placeholder {
  width: 200px;
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  background: linear-gradient(170deg, #ddeaf4 0%, #c8daea 100%);
}
[data-theme="dark"] .book-detail-cover-placeholder {
  background: linear-gradient(170deg, #1e2d3d 0%, #172233 100%);
  color: var(--text);
}
.detail-actions { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }

.book-detail h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}
.book-detail .subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.book-detail .author {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.meta-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.meta-chip {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Rating input */
.rating-input {
  display: flex;
  gap: 8px;
  margin-bottom: 1.25rem;
}
.rating-input span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.rating-input span:hover,
.rating-input span.filled { background: var(--accent-3); }
.rating-input span:hover   { transform: scale(1.4); }

/* ─── Forms ─── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 42px;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control {
  resize: vertical;
  min-height: 100px;
  line-height: 1.55;
}
select.form-control {
  cursor: pointer;
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 10px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.575rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 40px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.01em;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, #000);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); text-decoration: none; }
.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: color-mix(in srgb, var(--error) 30%, transparent);
}
.btn-danger:hover { background: var(--error); color: #fff; }
.btn-teal {
  background: var(--accent-2);
  color: #fff;
}
.btn-teal:hover { background: color-mix(in srgb, var(--accent-2) 85%, #000); text-decoration: none; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8125rem; min-height: 34px; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ─── Search Results ─── */
.search-results { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 1rem; }
.search-result-item {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.search-result-item:hover {
  border-color: var(--accent);
  transform: translateX(2px);
  box-shadow: var(--shadow);
}
.search-result-cover {
  width: 50px;
  height: 74px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--surface-2);
}
.search-result-info h3 { font-size: 0.9rem; font-weight: 600; }
.search-result-info p  { font-size: 0.8rem; color: var(--text-muted); }
.search-result-actions { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-end; }
.search-result-actions .btn { white-space: nowrap; }

/* ─── Recommendations ─── */
.rec-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 1rem;
  margin-bottom: 0.5rem;
  transition: border-color var(--transition);
}
.rec-item:hover { border-color: var(--accent); }
.rec-item-info h3 { font-size: 0.9rem; font-weight: 600; }
.rec-item-info .from { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }
.pool-remove { padding: 0.2rem 0.35rem; color: var(--text-muted); margin-left: auto; }
.pool-remove:hover { color: var(--danger, #c00); }
.rec-item-info .message {
  font-size: 0.8125rem;
  color: var(--text);
  font-style: italic;
  margin: 0.5rem 0;
  padding-left: 0.75rem;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 0 4px 4px 0;
  padding: 0.35rem 0.6rem;
}
.rec-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }

.pool-comment { font-size: 0.8125rem; margin-bottom: 0.5rem; padding: 0.4rem 0; }
.pool-comment p { margin: 0.25rem 0 0; color: var(--text); }
.pool-comment-form textarea { font-size: 0.875rem; min-height: 56px; }
.pool-cover-wrap { position: relative; }
.pool-cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pool-cover-wrap .book-cover-placeholder { width: 100%; height: 100%; min-height: 74px; display: flex !important; flex-direction: column; align-items: center; justify-content: center; padding: 4px; font-size: 9px; }
.pool-cover-wrap:hover { opacity: 0.9; }

.page-header-actions { display: flex; gap: 0.5rem; align-items: center; }

.next-books-dialog { max-width: 480px; }
.next-book-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem; margin-bottom: 0.35rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: grab;
}
.next-book-row:active { cursor: grabbing; }
.next-book-row.dragging { opacity: 0.5; }
.next-book-drag { color: var(--text-muted); font-size: 0.75rem; cursor: grab; }
.next-book-cover { width: 36px; height: 54px; min-width: 36px; min-height: 54px; border-radius: 4px; overflow: hidden; background: var(--surface-2); flex-shrink: 0; }
.next-book-cover img, .next-book-cover .next-book-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.next-book-cover .book-cover-placeholder { width: 100%; height: 100%; min-height: 54px; display: flex !important; flex-direction: column; align-items: center; justify-content: center; padding: 2px; }
.next-book-cover .ph-title { font-size: 7px; line-height: 1.1; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.next-book-cover .ph-author { display: none; }
.next-book-info { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.next-book-info strong { font-size: 0.9rem; }
.next-book-info span { font-size: 0.8rem; color: var(--text-muted); }
.next-book-actions { flex-shrink: 0; display: flex; align-items: center; gap: 0.35rem; }
.next-book-start { font-size: 0.75rem; padding: 0.25rem 0.5rem; white-space: nowrap; }
.next-book-remove { cursor: pointer; padding: 0.25rem 0.4rem; color: var(--text-muted); }
.next-book-remove:hover { color: var(--danger, #c00); }

/* ─── Auth Screen ─── */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #F8F8F9;
  padding: 1.75rem 2rem 1.5rem;
}
[data-theme="dark"] .auth-card-header {
  background: var(--surface-2);
}
.auth-card-body {
  padding: 2rem 2rem 2.5rem;
}
.auth-logo {
  flex-shrink: 0;
}
.auth-logo-img {
  height: 56px;
  width: auto;
  object-fit: contain;
  object-position: center center;
}
.auth-logo-dark { display: none; }
[data-theme="dark"] .auth-logo-light { display: none; }
[data-theme="dark"] .auth-logo-dark { display: block; }
.auth-card-header .auth-tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}
.auth-switch {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
  text-align: center;
}
.auth-switch a { color: var(--accent); font-weight: 500; }

/* ─── Misc ─── */
.error-msg {
  background: color-mix(in srgb, var(--error) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--error) 25%, transparent);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  color: var(--error);
  margin-bottom: 0.85rem;
}
.success-msg {
  background: color-mix(in srgb, var(--success) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  color: var(--success);
  margin-bottom: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
  letter-spacing: -0.015em;
}
.empty-state p { font-size: 0.875rem; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.loading-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1.25rem;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast.toast-error { background: var(--error); color: #fff; }
.toast.fade-out   { opacity: 0; transform: translateX(-50%) translateY(6px); }

/* ─── Dialog / Overlay ─── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fade-in 0.15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.dialog-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-hover);
  animation: slide-up 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slide-up { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.dialog-box h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}
.dialog-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }

/* ─── Tags row ─── */
.tab-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 34px;
  font-family: inherit;
}
.tab-btn:hover { color: var(--text); border-color: var(--accent); }
.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Year Scroller (Goals) ─── */
.year-scroller-wrap {
  position: relative;
  margin-bottom: 1.5rem;
  /* subtle fade on right edge */
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
  mask-image: linear-gradient(to right, black 85%, transparent 100%);
}
.year-scroller {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.year-scroller::-webkit-scrollbar { display: none; }

.year-pill {
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.55rem 0.85rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  min-width: 72px;
  font-family: inherit;
}
.year-pill:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--text);
}
.year-pill.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
}
.year-pill-year {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.year-pill-stat {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.year-pill.active .year-pill-stat { color: var(--accent); }
.year-pill-bar {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.year-pill-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 3px;
}

/* Goal Edit Card */
.goal-edit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

/* Monthly Chart */
.goal-monthly {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 78px;
  margin-top: 0.25rem;
}
.goal-month-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.goal-month-val {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 600;
  min-height: 12px;
  line-height: 1;
}
.goal-month-bar {
  width: 100%;
  max-width: 20px;
  border-radius: 2px 2px 0 0;
  background: var(--border);
  transition: height 0.4s ease, background 0.2s ease;
}
.goal-month-bar.has-books { background: var(--accent); }
.goal-month-label {
  font-size: 0.58rem;
  color: var(--text-light);
  line-height: 1;
}

/* ─── Description ─── */
.description-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-top: 0.75rem;
}
.description-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Recommended by ─── */
.recommended-by {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ─── Section label ─── */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ─── Bottom Navigation (Mobile) ─── */
#bottom-nav {
  display: none; /* shown via @media override */
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-align: center;
  min-height: 52px;
  transition: color var(--transition);
  position: relative;
  gap: 3px;
}
#bottom-nav a.active { color: var(--accent); font-weight: 600; }
#bottom-nav .badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 22px);
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 8px;
  font-weight: 600;
}
.nav-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  transition: transform var(--transition);
}
#bottom-nav a.active .nav-dot { transform: translateX(-50%) scale(1); }

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  :root { --sidebar-w: 200px; }
  #main { padding: 2rem 1.75rem; }
}

/* Tablet: schmale Sidebar */
@media (max-width: 860px) {
  :root { --sidebar-w: 180px; }
  #main { padding: 1.75rem 1.5rem; }
}

/* Mobile: Sidebar weg, Bottom-Nav ein */
@media (max-width: 640px) {
  #sidebar { display: none !important; }
  #bottom-nav { display: flex !important; }
  #main {
    margin-left: 0 !important;
    padding: 1.1rem 0.9rem 5.5rem;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
  }

  /* Buchgrid: 2 Spalten auf kleinen Screens */
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* Buchdetail: Stack layout */
  .book-detail {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .book-detail-cover-wrap {
    position: static;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
  }
  .book-detail-cover,
  .book-detail-cover-placeholder { width: 100px; }

  .book-detail h1 { font-size: 1.2rem; }

  /* Suche: Button ausblenden, nur Grid bleibt */
  .search-result-item { grid-template-columns: 44px 1fr; }
  .search-result-item .btn { display: none; }

  /* Toolbar: sekundäre Selects ausblenden, nur Status-Filter + Suche */
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .page-header .btn { align-self: stretch; justify-content: center; }
  .toolbar { gap: 0.4rem; }
  .toolbar-select-secondary { display: none; }
  .view-toggle { display: none; }

  /* Dialoge: volle Breite von unten */
  .dialog-overlay { align-items: flex-end; padding: 0; }
  .dialog-box {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width: 100%;
    padding: 1.5rem 1.25rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  }

  /* Toast höher setzen damit nicht hinter Bottom-Nav */
  .toast { bottom: calc(68px + env(safe-area-inset-bottom) + 8px); }

  /* Goal Widget kompakter */
  .goal-widget { padding: 1rem 1.1rem; }

  /* Auth-Card: kompakter auf Mobile */
  .auth-card-header { padding: 1.5rem 1.25rem 1.25rem; }
  .auth-card-body { padding: 1.5rem 1.25rem 2rem; }

  /* Empfehlungen: kompakteres Grid */
  .rec-item { grid-template-columns: 44px 1fr; gap: 0.75rem; }

  /* Profil: Aktionen volle Breite */
  .profile-actions { flex-direction: column; }
  .profile-actions .btn { min-width: 100%; }
}

/* Extra klein (z.B. iPhone SE: 375px) */
@media (max-width: 390px) {
  #main { padding: 0.9rem 0.75rem 5.5rem; }
  .book-grid { gap: 0.6rem; }
  html { font-size: 14px; }
}

@media (min-width: 1400px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
}
