/* Reader – Oberfläche (hell / sepia / dunkel) */

:root,
[data-theme="light"] {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --hover: #efede8;
  --active: #e7e4dd;
  --text: #1d1d1f;
  --text-2: #55534e;
  --muted: #8a877f;
  --border: #e6e3dc;
  --border-strong: #d6d2c8;
  --accent: #3651c4;
  --accent-hover: #2c44a8;
  --accent-soft: #e8ecfb;
  --accent-text: #ffffff;
  --danger: #c4372f;
  --danger-soft: #fbeceb;
  --success: #2f8a4f;
  --shadow: 0 1px 2px rgba(20, 20, 15, .06), 0 4px 16px rgba(20, 20, 15, .06);
  --shadow-lg: 0 10px 40px rgba(20, 20, 15, .16), 0 2px 6px rgba(20, 20, 15, .08);
  --cover-bg: #ebe8e1;
  --hl-yellow: rgba(255, 213, 0, .38);
  --hl-green: rgba(64, 200, 110, .32);
  --hl-blue: rgba(60, 150, 255, .30);
  --hl-pink: rgba(255, 90, 160, .30);
  --hl-purple: rgba(150, 100, 255, .30);
  --dot-yellow: #f2c200;
  --dot-green: #3dbb69;
  --dot-blue: #3b8ff0;
  --dot-pink: #ec4f97;
  --dot-purple: #8d63f0;
  color-scheme: light;
}

[data-theme="sepia"] {
  --bg: #efe6d2;
  --surface: #f8f1e1;
  --surface-2: #f4ecda;
  --hover: #e8dcc3;
  --active: #e0d2b5;
  --text: #3a2f22;
  --text-2: #5e4f3d;
  --muted: #8c7a62;
  --border: #e0d3b8;
  --border-strong: #d2c19f;
  --accent: #9a5a1c;
  --accent-hover: #824a14;
  --accent-soft: #f0dfc3;
  --cover-bg: #e5d8bd;
  --shadow: 0 1px 2px rgba(60, 40, 10, .08), 0 4px 16px rgba(60, 40, 10, .07);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #141414;
  --surface: #1c1c1e;
  --surface-2: #202022;
  --hover: #2a2a2d;
  --active: #333336;
  --text: #ececec;
  --text-2: #c2c2c2;
  --muted: #8e8e93;
  --border: #2c2c2f;
  --border-strong: #3a3a3e;
  --accent: #7b93f5;
  --accent-hover: #93a7f8;
  --accent-soft: #252c4a;
  --accent-text: #0e1020;
  --danger: #ff6b61;
  --danger-soft: #3a1f1d;
  --success: #57c27c;
  --cover-bg: #2a2a2d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
  --hl-yellow: rgba(255, 213, 0, .30);
  --hl-green: rgba(64, 200, 110, .28);
  --hl-blue: rgba(60, 150, 255, .30);
  --hl-pink: rgba(255, 90, 160, .30);
  --hl-purple: rgba(150, 100, 255, .32);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
mark { background: var(--hl-yellow); color: inherit; border-radius: 2px; padding: 0 1px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.icon.filled { fill: currentColor; }

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px; border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a877f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.checkbox { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }

/* ---------- App-Layout ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  padding: calc(16px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
  border-right: 1px solid var(--border); background: var(--bg);
  display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.nav-section { margin-top: 18px; margin-bottom: 4px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav-section .icon-btn { width: 24px; height: 24px; border-radius: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; cursor: pointer; min-height: 34px;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); font-weight: 550; }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item .icon { color: var(--muted); }
.nav-item.active .icon { color: var(--text); }
.sidebar-footer { margin-top: auto; padding-top: 16px; }
.sync-pill { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12.5px; color: var(--muted); border-radius: 8px; }
.sync-pill.error { color: var(--danger); }
.sync-pill .spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.main { min-width: 0; background: var(--surface); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 28px 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.topbar h1 { font-size: 19px; font-weight: 650; margin: 0; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .count-badge { color: var(--muted); font-weight: 450; font-size: 15px; margin-left: 4px; }
.topbar .spacer { flex: 1; }
.search-box { position: relative; width: min(340px, 40vw); }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 34px; height: 36px; background: var(--surface-2); }
.content { padding: 24px 28px calc(48px + env(safe-area-inset-bottom)); max-width: 1500px; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--hover); gap: 2px; }
.seg button, .seg a {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font-size: 13px; font-weight: 500;
  color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.seg .active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px;
  background: var(--hover); color: var(--text-2); white-space: nowrap; }
.chip .icon { width: 12px; height: 12px; }

/* ---------- Weiterlesen ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 12px; }
.section-title h2 { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.continue-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 340px); gap: 14px; overflow-x: auto;
  padding-bottom: 8px; margin-bottom: 28px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.continue-card {
  display: flex; gap: 14px; padding: 12px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); scroll-snap-align: start; transition: border-color .12s, box-shadow .12s;
}
.continue-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.continue-card .cover { width: 66px; flex: none; border-radius: 6px; }
.continue-card .info { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.continue-card .title { font-weight: 600; font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.continue-card .author { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-card .meta { margin-top: auto; font-size: 12.5px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; }

/* ---------- Cover ---------- */
.cover {
  position: relative; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: var(--cover-bg);
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 3px 10px rgba(0,0,0,.08);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: 12% 10% 24%; color: #fff; font-weight: 650; line-height: 1.2; overflow: hidden;
  background: linear-gradient(160deg, hsl(var(--h, 220) 45% 46%), hsl(calc(var(--h, 220) + 30) 50% 32%));
}
.cover .ph .t { font-size: clamp(9px, 1.1vw, 15px); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.cover .ph .a { font-size: clamp(7px, .8vw, 11px); font-weight: 500; opacity: .85; }
.cover .fmt { position: absolute; left: 6px; bottom: 6px; font-size: 9.5px; font-weight: 700; letter-spacing: .05em;
  padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.55); color: #fff; text-transform: uppercase; }
.cover .done { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--success); color: #fff; display: flex; align-items: center; justify-content: center; }
.cover .done .icon { width: 13px; height: 13px; stroke-width: 3; }
.cover .offline-badge { position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; }
.cover .offline-badge .icon { width: 12px; height: 12px; }

.progress { height: 4px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- Raster ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 22px; }
.card { position: relative; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.card .cover { transition: transform .15s, box-shadow .15s; }
.card:hover .cover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.12), 0 10px 24px rgba(0,0,0,.14); }
.card .title { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .author { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -5px; }
.card .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); gap: 6px; }
.card .menu-trigger { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,.92); color: #222; box-shadow: 0 1px 3px rgba(0,0,0,.2); opacity: 0; transition: opacity .12s; }
.card:hover .menu-trigger, .card .menu-trigger:focus { opacity: 1; }
@media (hover: none) { .card .menu-trigger { opacity: 1; width: 26px; height: 26px; top: 5px; right: 5px; background: rgba(255,255,255,.8); } .card .menu-trigger .icon { width: 15px; height: 15px; } .cover .ph .t { padding-right: 18px; } }

/* ---------- Liste ---------- */
.list { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 160px 120px 36px; align-items: center; gap: 16px;
  padding: 10px 8px; border-bottom: 1px solid var(--border); border-radius: 8px; }
.row:hover { background: var(--surface-2); }
.row .cover { width: 44px; border-radius: 4px; }
.row .cover .ph .t { font-size: 6px; }
.row .cover .ph .a, .row .cover .fmt { display: none; }
.row .title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.row .prog { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); }
.row .time { font-size: 12.5px; color: var(--text-2); text-align: right; }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .icon { width: 42px; height: 42px; stroke-width: 1.3; margin-bottom: 10px; color: var(--border-strong); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 auto 18px; max-width: 420px; }

/* ---------- Menüs, Dialoge, Toasts ---------- */
.menu {
  position: fixed; z-index: 100; min-width: 210px; max-width: 290px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
.menu button, .menu a {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none;
  border-radius: 7px; font-size: 14px; text-align: left; cursor: pointer; color: var(--text);
}
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu .sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu .danger { color: var(--danger); }
.menu .check { margin-left: auto; color: var(--accent); }
.menu .head { font-size: 11.5px; color: var(--muted); padding: 6px 10px 3px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(10,10,10,.38); display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(480px, 100%); max-height: calc(100dvh - 40px); overflow: auto; background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 22px; animation: pop .15s ease-out; }
.modal h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.01em; }
.modal p { margin: 0 0 16px; color: var(--text-2); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toasts { position: fixed; z-index: 200; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 30px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px;
  background: #1f1f22; color: #f2f2f2; box-shadow: var(--shadow-lg); font-size: 14px; animation: pop .15s ease-out; }
.toast.error { background: #6e1f1a; }
.toast button { border: 0; background: rgba(255,255,255,.14); color: #fff; padding: 4px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; }

/* Upload */
.drop-overlay { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent); backdrop-filter: blur(3px); }
.drop-overlay.show { display: flex; }
.drop-overlay .box { padding: 40px 60px; border: 2px dashed var(--accent); border-radius: 20px; background: var(--surface);
  text-align: center; font-weight: 600; color: var(--accent); box-shadow: var(--shadow-lg); }
.drop-overlay .box .icon { width: 36px; height: 36px; margin: 0 auto 10px; display: block; }
.upload-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; max-height: 50vh; overflow: auto; }
.upload-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13.5px; }
.upload-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .state { color: var(--muted); font-size: 12.5px; }
.upload-item .state.ok { color: var(--success); }
.upload-item .state.err { color: var(--danger); }
.upload-item .progress { grid-column: 1 / -1; }

/* ---------- Buchdetails ---------- */
.book-hero { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 36px; align-items: start; margin-bottom: 36px; }
.book-hero .cover { width: 210px; border-radius: 8px; }
.book-hero h1 { font-size: 27px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.02em; }
.book-hero .author { font-size: 16px; color: var(--text-2); margin-bottom: 18px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.facts b { color: var(--text-2); font-weight: 550; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 18px 0; max-width: 640px; }
.stat { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.stat .v { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 1px; }
.panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 18px 20px; margin-bottom: 18px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.panel h2 .count { color: var(--muted); font-weight: 450; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }

.hl-list { display: flex; flex-direction: column; }
.hl { display: grid; grid-template-columns: 4px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.hl:last-child { border-bottom: 0; }
.hl .bar { border-radius: 4px; background: var(--dot-yellow); }
.hl[data-color="green"] .bar { background: var(--dot-green); }
.hl[data-color="blue"] .bar { background: var(--dot-blue); }
.hl[data-color="pink"] .bar { background: var(--dot-pink); }
.hl[data-color="purple"] .bar { background: var(--dot-purple); }
.hl .text { font-family: "Iowan Old Style", Charter, Georgia, serif; font-size: 15.5px; line-height: 1.55; white-space: pre-wrap; }
.hl .note { margin-top: 7px; font-size: 13.5px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 7px 10px;
  border-left: 3px solid var(--border-strong); white-space: pre-wrap; }
.hl .meta { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.hl .meta a:hover { color: var(--accent); }
.hl .tools { display: flex; gap: 2px; align-items: flex-start; }
.hl .tools .icon-btn { width: 30px; height: 30px; }
.bm-list .bm { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.bm-list .bm:last-child { border-bottom: 0; }
.bm-list .bm a { flex: 1; min-width: 0; }
.bm-list .bm a:hover { color: var(--accent); }

.hl-group { margin-bottom: 30px; }
.hl-group-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.hl-group-head .cover { width: 36px; border-radius: 4px; }
.hl-group-head .cover .ph .t, .hl-group-head .cover .ph .a, .hl-group-head .cover .fmt { display: none; }
.hl-group-head .t { font-weight: 650; }
.color-dots { display: inline-flex; gap: 6px; }
.color-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.color-dot.active { border-color: var(--text); }
.color-dot[data-color="yellow"] { background: var(--dot-yellow); }
.color-dot[data-color="green"] { background: var(--dot-green); }
.color-dot[data-color="blue"] { background: var(--dot-blue); }
.color-dot[data-color="pink"] { background: var(--dot-pink); }
.color-dot[data-color="purple"] { background: var(--dot-purple); }
.color-dot.all { background: conic-gradient(var(--dot-yellow), var(--dot-green), var(--dot-blue), var(--dot-purple), var(--dot-pink), var(--dot-yellow)); }

/* Suche */
.search-section { margin-bottom: 30px; }
.search-section h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; font-weight: 650; }
.hit-book { margin-bottom: 18px; }
.hit-book .bt { font-weight: 650; margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; }
.hit { display: block; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border); margin-bottom: 6px; font-size: 14px; line-height: 1.5; }
.hit:hover { border-color: var(--border-strong); background: var(--surface-2); }
.hit .where { font-size: 12px; color: var(--muted); margin-bottom: 2px; }

/* Einstellungen */
.settings { max-width: 760px; }
.settings .panel p { color: var(--text-2); margin: 0 0 12px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; font-size: 14px; margin: 6px 0 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--hover); padding: 2px 6px; border-radius: 5px; overflow-wrap: anywhere; }
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; background: var(--accent-soft); }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.theme-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.theme-pick button { border: 2px solid var(--border); border-radius: 12px; padding: 12px 8px; cursor: pointer; font-size: 13px; font-weight: 550; background: var(--surface); }
.theme-pick button.active { border-color: var(--accent); }
.theme-pick .sw { height: 34px; border-radius: 7px; margin-bottom: 7px; border: 1px solid rgba(0,0,0,.08); }

/* Login */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 32px 28px; box-shadow: var(--shadow); }
.login-card .logo { width: 52px; height: 52px; border-radius: 13px; margin: 0 auto 14px; }
.login-card h1 { text-align: center; font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.login-card .btn { width: 100%; height: 42px; margin-top: 6px; }
.login-card .err { color: var(--danger); font-size: 13.5px; margin-bottom: 12px; text-align: center; }
.login-card .remember { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 16px; }

.offline-banner { display: none; position: fixed; top: env(safe-area-inset-top); left: 50%; transform: translateX(-50%); z-index: 150;
  margin-top: 8px; padding: 5px 12px; border-radius: 99px; background: #1f1f22; color: #fff; font-size: 12.5px; align-items: center; gap: 6px; }
body.is-offline .offline-banner { display: flex; }

/* ---------- Mobil ---------- */
.scrim { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: 280px; transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.3); }
  .topbar { padding-left: 12px; padding-right: 12px; gap: 6px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar h1 { font-size: 17px; }
  .search-box { width: auto; flex: 1; }
  .topbar .spacer { display: none; }
  .content { padding: 16px 14px calc(40px + env(safe-area-inset-bottom)); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 20px 14px; }
  .card .title { font-size: 13px; }
  .card .meta { font-size: 11.5px; flex-direction: column; gap: 0; }
  .cover .ph .t { font-size: 11px; }
  .cover .ph .a { font-size: 8px; }
  .continue-row { grid-auto-columns: 82%; }
  .row { grid-template-columns: 40px minmax(0, 1fr) 36px; gap: 12px; }
  .row .prog, .row .time { display: none; }
  .row .sub .rt { display: inline; }
  .book-hero { grid-template-columns: 110px minmax(0, 1fr); gap: 18px; }
  .book-hero .cover { width: 110px; }
  .book-hero h1 { font-size: 20px; }
  .two-col { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .theme-pick { grid-template-columns: repeat(2, 1fr); }
  .hide-mobile { display: none !important; }
}
@media (min-width: 861px) { .row .sub .rt { display: none; } .show-mobile { display: none !important; } }
