/* Bibliothek – angelehnt an iOS 27: Glas nur in der Navigation, ruhige Inhaltsflächen,
   feine Ränder statt Schatten, moderate Ecken, große Titel. */
:root {
  --bg: #f2f2f7;               /* iOS „grouped background“ */
  --surface: #ffffff;
  --surface-2: #e9e9ee;
  --fill: rgba(120, 120, 128, .12);
  --fill-2: rgba(120, 120, 128, .2);
  --text: #1c1c1e;
  --muted: rgba(60, 60, 67, .62);
  --faint: rgba(60, 60, 67, .3);
  --line: rgba(60, 60, 67, .16);
  --accent: #f26b1d;
  --accent-ink: #c2510e;       /* Textfarbe in Akzent, AA auf Weiß */
  --on-accent: #ffffff;
  --ok: #248a3d;
  --ok-soft: rgba(52, 199, 89, .14);
  --warn: #a05a00;
  --warn-soft: rgba(255, 159, 10, .16);
  --danger: #d70015;
  --danger-soft: rgba(255, 59, 48, .12);
  --blue: #007aff; --green: #34c759; --pink: #ff2d55; --yellow: #ffb800; --gray: #8e8e93; --purple: #af52de;
  --lp: #1c1c1e; --cd: #6e7f94; --dvd: #6e4fd8; --bluray: #0a64e0; --uhd: #0e8a7e;
  /* Glas: hell, leicht getönt, klarer Rand */
  --glass: rgba(250, 250, 252, .72);
  --glass-strong: rgba(250, 250, 252, .86);
  --glass-edge: rgba(255, 255, 255, .9);
  --glass-line: rgba(0, 0, 0, .08);
  --glass-blur: saturate(180%) blur(22px);
  --tab-on: rgba(0, 0, 0, .07);
  --radius: 12px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
/* Dunkel: per Profil erzwungen (data-theme="dark") oder automatisch nach System, außer „Hell“ ist gewählt */
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --fill: rgba(120, 120, 128, .24);
  --fill-2: rgba(120, 120, 128, .34);
  --text: #f5f5f7;
  --muted: rgba(235, 235, 245, .6);
  --faint: rgba(235, 235, 245, .3);
  --line: rgba(84, 84, 88, .55);
  --accent: #ff8a3d;
  --accent-ink: #ff9f5c;
  --on-accent: #1c1c1e;
  --ok: #30d158; --ok-soft: rgba(48, 209, 88, .16);
  --warn: #ffb340; --warn-soft: rgba(255, 159, 10, .18);
  --danger: #ff6961; --danger-soft: rgba(255, 69, 58, .18);
  --lp: #3a3a3c;
  /* iOS 27: Glas im Dunkelmodus deutlich heller, der aktive Tab dunkler */
  --glass: rgba(92, 92, 98, .52);
  --glass-strong: rgba(72, 72, 78, .78);
  --glass-edge: rgba(255, 255, 255, .2);
  --glass-line: rgba(255, 255, 255, .1);
  --tab-on: rgba(0, 0, 0, .38);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(120, 120, 128, .24);
    --fill-2: rgba(120, 120, 128, .34);
    --text: #f5f5f7;
    --muted: rgba(235, 235, 245, .6);
    --faint: rgba(235, 235, 245, .3);
    --line: rgba(84, 84, 88, .55);
    --accent: #ff8a3d;
    --accent-ink: #ff9f5c;
    --on-accent: #1c1c1e;
    --ok: #30d158; --ok-soft: rgba(48, 209, 88, .16);
    --warn: #ffb340; --warn-soft: rgba(255, 159, 10, .18);
    --danger: #ff6961; --danger-soft: rgba(255, 69, 58, .18);
    --lp: #3a3a3c;
    /* iOS 27: Glas im Dunkelmodus deutlich heller, der aktive Tab dunkler */
    --glass: rgba(92, 92, 98, .52);
    --glass-strong: rgba(72, 72, 78, .78);
    --glass-edge: rgba(255, 255, 255, .2);
    --glass-line: rgba(255, 255, 255, .1);
    --tab-on: rgba(0, 0, 0, .38);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font: 17px/1.42 var(--font); letter-spacing: -.01em; background: var(--bg); color: var(--text);
  padding-bottom: calc(96px + env(safe-area-inset-bottom)); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, .large-title { font-family: var(--font-display); font-size: 2.05rem; font-weight: 700; letter-spacing: -.025em;
  line-height: 1.12; margin: .35em 0 .45em; }
h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 .55em; }
h3 { font-size: 1.02rem; font-weight: 600; margin: 1em 0 .4em; }
code { font: .88em ui-monospace, "SF Mono", Menlo, monospace; background: var(--fill); padding: 1px 6px; border-radius: 6px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.danger { color: var(--danger); }
.prewrap { white-space: pre-wrap; }
.grow { flex: 1; min-width: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: .3em 0 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 4px 20px 32px; }
.ico { flex: none; display: block; }

/* ------------------------------------------------------------ Glas */
.glass { background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-edge); }
@media (prefers-reduced-transparency: reduce) {
  .glass, .topbar { background: var(--surface) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}

/* ------------------------------------------------------------ Kopfleiste */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 20px 8px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid transparent; transition: border-color .2s; }
body.scrolled .topbar { border-bottom-color: var(--line); }   /* harte Scrollkante wie in iOS 27 */
.brand { display: flex; align-items: center; gap: 9px; font: 700 1.08rem var(--font-display); color: var(--text); letter-spacing: -.02em; }
.brand img { border-radius: 8px; }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: 2px; padding: 3px; border-radius: 99px; margin-left: 8px; }
.mainnav a { white-space: nowrap; color: var(--text); padding: 6px 13px; border-radius: 99px; font-size: .9rem; font-weight: 500; opacity: .78; }
.mainnav a:hover { text-decoration: none; opacity: 1; }
.mainnav a.on { background: var(--tab-on); opacity: 1; font-weight: 600; }
.topsearch { margin-left: auto; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 99px;
  width: min(260px, 32vw); color: var(--muted); }
.topsearch input { border: 0; background: transparent; padding: 8px 0; width: 100%; outline: none; box-shadow: none; }
.topsearch input:focus { outline: none; box-shadow: none; }
.topsearch:focus-within { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; display: grid;
  place-items: center; font-weight: 600; color: var(--text); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu .menu { position: absolute; right: 0; top: 46px; border-radius: 16px; padding: 6px; min-width: 250px;
  display: grid; background: var(--glass-strong); box-shadow: 0 10px 40px rgba(0, 0, 0, .18), inset 0 1px 0 var(--glass-edge); }
.menu-head { padding: 8px 12px 6px; font-size: .8rem; color: var(--muted); }
.theme-picker { margin: 0; width: 100%; }
.theme-picker .segmented { display: flex; width: 100%; }
.theme-picker .segmented button { flex: 1; padding: 6px 8px; }
.usermenu .theme-picker { padding: 4px 6px 8px; border-bottom: .5px solid var(--line); margin-bottom: 4px; }
.usermenu .menu a, .menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--text); font: inherit; font-size: .95rem; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.usermenu .menu a:hover, .menu-item:hover { background: var(--fill); text-decoration: none; }
.usermenu .menu .ico { color: var(--muted); }

@media (max-width: 1200px) { .mainnav { display: none; } }
@media (max-width: 720px) {
  .topbar { padding: calc(6px + env(safe-area-inset-top)) 16px 6px; gap: 10px; }
  .brand span, .topbar .scanbtn, .usermenu { display: none; }
  .topsearch { width: auto; flex: 1; margin-left: 4px; }
  .wrap { padding: 0 16px 24px; }
}

/* ------------------------------------------------------------ Schwebende Tab-Leiste */
.tabdock { position: fixed; z-index: 30; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom));
  display: none; justify-content: center; align-items: center; gap: 10px; padding: 0 18px; pointer-events: none; }
.tabdock > * { pointer-events: auto; }
.tabbar { display: flex; padding: 4px; border-radius: 99px; flex: 1; max-width: 360px;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 8px 30px rgba(0, 0, 0, .12); transition: max-width .25s ease, padding .25s; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px 5px;
  border-radius: 99px; color: var(--text); font-size: .66rem; font-weight: 500; letter-spacing: 0; transition: background .2s; }
.tabbar a:hover { text-decoration: none; }
.tabbar a.on { background: var(--tab-on); color: var(--accent-ink); font-weight: 600; }
.tabscan { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; color: var(--on-accent);
  background: color-mix(in srgb, var(--accent) 88%, transparent); border-color: rgba(255, 255, 255, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 8px 26px color-mix(in srgb, var(--accent) 40%, transparent); flex: none; }
.tabscan:hover { text-decoration: none; filter: brightness(1.05); }
.tabscan.on { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); }
/* Beim Runterscrollen schrumpft die Leiste auf die Symbole */
body.compact .tabbar { max-width: 230px; }
body.compact .tabbar a span { display: none; }
body.compact .tabbar a { padding: 9px 4px; }
body.compact .tabscan { width: 50px; height: 50px; }
/* Unterhalb der vollen Desktop-Breite übernimmt die Tab-Leiste die Navigation */
@media (max-width: 1200px) { .tabdock { display: flex; } }
@media (min-width: 1201px) { body { padding-bottom: 0; } }
@media (prefers-reduced-motion: reduce) { .tabbar, .tabbar a, .topbar { transition: none; } }

/* ------------------------------------------------------------ Bedienelemente */
input, select, textarea { font: inherit; font-size: 1rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; min-width: 0; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  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='%238e8e93' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea { width: 100%; resize: vertical; }
.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; font: inherit; font-size: .95rem;
  font-weight: 600; padding: 8px 16px; border-radius: 99px; border: 0; background: var(--fill); color: var(--accent-ink);
  cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s; }
.btn:hover { background: var(--fill-2); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.ghost { background: transparent; color: var(--accent-ink); }
.btn.big { padding: 12px 22px; font-size: 1.02rem; }
.btn.sm { padding: 5px 12px; font-size: .84rem; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.file { cursor: pointer; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); cursor: pointer; }
.linklike.danger, .danger.linklike { color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 7px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
.chip { display: inline-flex; gap: 5px; align-items: center; padding: 4px 11px; border-radius: 99px; background: var(--fill);
  color: var(--text); font-size: .83rem; font-weight: 500; margin: 0 4px 6px 0; }
.chip.on { background: var(--text); color: var(--bg); }
.chip:hover { text-decoration: none; background: var(--fill-2); }
.chip.on:hover { background: var(--text); }
.chips { margin-bottom: 14px; }
.badge { display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .01em; padding: 2px 7px; border-radius: 6px;
  background: var(--fill); color: var(--muted); vertical-align: middle; }
.badge.t-lp, .badge.t-single { background: var(--lp); color: #fff; }
.badge.t-cd { background: var(--cd); color: #fff; }
.badge.t-dvd { background: var(--dvd); color: #fff; }
.badge.t-bluray { background: var(--bluray); color: #fff; }
.badge.t-uhd { background: var(--uhd); color: #fff; }
.badge.lent { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.stars { color: var(--yellow); letter-spacing: 1px; }
.stars.sm { font-size: .78rem; }
.flash { padding: 11px 15px; border-radius: var(--radius); margin: 8px 0 14px; background: var(--fill); font-size: .95rem; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.segmented { display: inline-flex; background: var(--fill); border-radius: 10px; padding: 2px; gap: 0; }
.segmented a, .segmented button { padding: 6px 16px; border-radius: 8px; color: var(--text); font: inherit; font-size: .9rem;
  font-weight: 500; border: 0; background: none; cursor: pointer; }
.segmented .on { background: var(--surface); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
:root[data-theme="dark"] .segmented .on { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented .on { background: #636366; } }
.segmented a:hover { text-decoration: none; }

.panel { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; margin: 18px 0; }
.warn-panel { background: var(--warn-soft); }
.warn-panel h2 { color: var(--warn); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { margin-bottom: .45em; }
.section-head > a { font-size: .95rem; }
section > .section-head { margin-top: 22px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.two-col.wide-left { grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 760px) { .two-col, .two-col.wide-left { grid-template-columns: 1fr; } }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: .5px solid var(--line); }
.rows li:last-child { border-bottom: 0; }

/* ------------------------------------------------------------ Gruppierte Listen (wie iOS-Einstellungen) */
.group { background: var(--surface); border-radius: var(--radius); margin: 10px 0 22px; overflow: hidden; }
.group-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 22px 16px 6px; font-weight: 500; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px 11px 16px; color: var(--text); min-height: 48px; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 58px; border-top: .5px solid var(--line); }
a.row:hover { text-decoration: none; background: var(--fill); }
a.row:active { background: var(--fill-2); }
.row-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.row-label { flex: 1; min-width: 0; }
.row-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.row > .ico-chevron { color: var(--faint); }
.c-blue { background: var(--blue); } .c-green { background: var(--green); } .c-pink { background: var(--pink); }
.c-yellow { background: var(--yellow); } .c-gray { background: var(--gray); } .c-orange { background: var(--accent); }
.c-purple { background: var(--purple); }
.row-ico.t-lp, .row-ico.t-single { background: var(--lp); } .row-ico.t-cd { background: var(--cd); }
.row-ico.t-dvd { background: var(--dvd); } .row-ico.t-bluray { background: var(--bluray); } .row-ico.t-uhd { background: var(--uhd); }
.row-ico.lent { background: #ff9f0a; }
:root[data-theme="dark"] .row-ico.t-lp, :root[data-theme="dark"] .row-ico.t-single { background: #48484a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .row-ico.t-lp, :root:not([data-theme="light"]) .row-ico.t-single { background: #48484a; } }

/* ------------------------------------------------------------ Cover */
.cover { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--fill);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08); }
.cover.t-dvd, .cover.t-bluray, .cover.t-uhd { aspect-ratio: 27 / 38; }
.cover.ph { display: grid; place-items: center; color: rgba(255, 255, 255, .88); font: 700 2.2rem var(--font-display);
  background: linear-gradient(160deg, #3a3a3c, #1c1c1e); }
.cover.ph.t-lp, .cover.ph.t-single { background: repeating-radial-gradient(circle at 50% 50%, #1c1c1e 0 2px, #2a2a2c 2px 4px); }
.cover.ph.t-lp span, .cover.ph.t-single span { background: var(--accent); width: 34%; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.05rem; color: #fff; }
.cover.ph.t-cd { background: conic-gradient(from 30deg, #d6dfe9, #efe6f6, #d9f1ec, #ece7d1, #d6dfe9); color: #445; }
.cover.ph.t-dvd { background: linear-gradient(160deg, #7c5ce6, #3a2490); }
.cover.ph.t-bluray { background: linear-gradient(160deg, #3d8bfd, #0b3f9c); }
.cover.ph.t-uhd { background: linear-gradient(160deg, #20c4b2, #0a4a44); }
.cover.xs { width: 44px; height: 44px; aspect-ratio: auto; font-size: 1rem; flex: none; border-radius: 6px; }
.cover.sm { width: 60px; height: 60px; aspect-ratio: auto; font-size: 1.3rem; flex: none; border-radius: 7px; }
.cover.big { max-width: 340px; border-radius: 10px; }

/* ------------------------------------------------------------ Startseite */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 4px; }
.hero h1 { margin-bottom: .1em; }
.hero p { margin: 0; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) { .hero-actions { display: none; } }
.stat-row { display: flex; gap: 10px; margin: 18px 0 6px; overflow-x: auto; scrollbar-width: none; }
.stat { flex: 1 0 120px; background: var(--surface); border-radius: var(--radius); padding: 12px 14px; color: var(--text); }
.stat:hover { text-decoration: none; background: color-mix(in srgb, var(--surface) 92%, var(--text)); }
.stat-n { display: block; font: 700 1.7rem/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-l { font-size: .82rem; color: var(--muted); }
.stat.warn .stat-n { color: var(--warn); }

/* ------------------------------------------------------------ Raster */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 22px 16px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 18px 12px; }
@media (max-width: 520px) { .grid, .grid.small { grid-template-columns: repeat(2, 1fr); gap: 18px 14px; } }
.card { display: flex; flex-direction: column; color: var(--text); }
.card:hover { text-decoration: none; }
.card:hover .cover { transform: scale(1.015); }
.card:active .cover { transform: scale(.98); }
.card-cover { position: relative; display: flex; align-items: flex-end; }
.card-cover .cover { transition: transform .2s ease; box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 0 0 .5px rgba(0, 0, 0, .06); }
.ribbon { position: absolute; top: 7px; left: 7px; font-size: .68rem; font-weight: 600; padding: 3px 8px; border-radius: 99px;
  color: #fff; background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.card-body { display: flex; flex-direction: column; padding: 8px 1px 0; font-size: .9rem; line-height: 1.28; gap: 1px; }
.card-body strong { font-weight: 600; }
.card-body .meta { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 2px 0 20px; }
.filters input[type=search] { flex: 1 1 200px; border-radius: 99px; background: var(--fill); border-color: transparent; }
.filters select { border-radius: 99px; background-color: var(--fill); border-color: transparent; font-size: .9rem; padding-top: 7px; padding-bottom: 7px; }
.viewtoggle { margin-left: auto; display: inline-flex; background: var(--fill); border-radius: 10px; padding: 2px; }
.viewtoggle a { padding: 4px 11px; color: var(--muted); border-radius: 8px; }
.viewtoggle a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.viewtoggle a:hover { text-decoration: none; }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
table.list th, table.list td { text-align: left; padding: 9px 12px; border-bottom: .5px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list th { font-size: .76rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
table.list .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.list .thumb { width: 58px; }
table.list.compact td { font-size: .9rem; vertical-align: top; }
.panel table.list th, .panel table.list td { padding-left: 0; }

/* ------------------------------------------------------------ Detail */
.detail-bg { position: relative; margin: 0 -20px; padding: 8px 20px 4px; border-radius: 0 0 28px 28px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint, transparent) 38%, transparent), transparent 92%); transition: background .4s; }
@media (max-width: 720px) { .detail-bg { margin: 0 -16px; padding: 8px 16px 4px; } }
.detail { display: grid; grid-template-columns: minmax(200px, 320px) 1fr; gap: 32px; padding-top: 14px; }
@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; gap: 14px; text-align: center; }
  .detail-cover { max-width: 250px; margin: 0 auto; }
  .detail .facts { text-align: left; }
  .detail .actions, .detail .buy, .detail .crumbs { justify-content: center; }
  .detail .where { text-align: left; }
}
.detail-cover { position: relative; }
.detail-cover .cover { box-shadow: 0 18px 50px color-mix(in srgb, var(--tint, #000) 45%, transparent), 0 0 0 .5px rgba(0, 0, 0, .08); }
.detail-cover .qr { display: block; margin: 16px auto 0; background: #fff; padding: 6px; border-radius: 10px; }
@media (max-width: 720px) { .detail-cover .qr { display: none; } }
.detail h1 { margin: .15em 0 .1em; }
.crumbs { margin: 0; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.crumbs .chip { margin: 0; }
.artist { font-size: 1.2rem; margin: 0 0 .4em; color: var(--accent-ink); }
.artist a { font-weight: 500; }
.where { background: var(--surface); border-radius: var(--radius); padding: 13px 15px; display: grid; gap: 10px; margin: 16px 0; }
.where.lent { background: var(--warn-soft); }
.where .i { display: inline-block; width: 1.3em; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-actions form { display: inline; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 14px 0; background: var(--surface);
  border-radius: var(--radius); padding: 2px 15px; }
.facts dt, .facts dd { padding: 9px 0; border-bottom: .5px solid var(--line); margin: 0; }
.facts dt { color: var(--muted); padding-right: 18px; }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.buy { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.shops { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.shop { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 99px; font-weight: 600; font-size: .83rem;
  color: var(--text); background: var(--fill); }
.shop::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.shops.sm .shop { padding: 3px 9px; font-size: .74rem; }
.shop:hover { text-decoration: none; background: var(--fill-2); }
.shop-amazon::before { background: #ff9900; }
.shop-rebuy::before { background: #00a0e1; }
.shop-ebay::before { background: #e53238; }
.tracks { columns: 2 260px; margin: 0; padding-left: 0; list-style: none; font-size: .95rem; }
.tracks li { break-inside: avoid; padding: 3px 0; }
.tracks li.disc { font-weight: 600; color: var(--muted); margin-top: 8px; }
details > summary { cursor: pointer; }
details > summary h2 { display: inline; }
.review { border-bottom: .5px solid var(--line); padding: 10px 0; }
.review p { margin: 4px 0 0; }
.review-form { margin-top: 12px; display: grid; gap: 10px; }
.rating { border: 0; padding: 0; margin: 0; display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; }
.rating input { position: absolute; opacity: 0; width: 1px; }
.rating label { font-size: 2rem; color: var(--fill-2); cursor: pointer; padding: 0 2px; line-height: 1; }
.rating input:checked ~ label, .rating label:hover, .rating label:hover ~ label { color: var(--yellow); }
.rating input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }

/* ------------------------------------------------------------ Formular */
.media-form { display: grid; grid-template-columns: 220px 1fr; gap: 26px; }
@media (max-width: 720px) { .media-form { grid-template-columns: 1fr; } .form-cover { max-width: 200px; } }
.form-cover { display: grid; gap: 10px; align-content: start; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; align-content: start;
  background: var(--surface); border-radius: var(--radius); padding: 16px; }
.form-grid label { display: grid; gap: 5px; font-size: .8rem; color: var(--muted); font-weight: 500; }
.form-grid label.check { display: flex; align-self: end; padding-bottom: 9px; color: var(--text); font-size: .95rem; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; color: var(--text); font-weight: 400;
  background-color: var(--bg); border-color: transparent; }
.form-grid .wide, .form-grid h3 { grid-column: 1 / -1; }
.form-grid .wide2 { grid-column: span 2; }
@media (max-width: 520px) { .form-grid .wide2 { grid-column: 1 / -1; } }
.form-grid h3 { margin: 12px 0 -2px; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  font-weight: 500; border-top: .5px solid var(--line); padding-top: 16px; }
.form-grid.inner { margin-top: 12px; padding: 0; }
.more summary { font-weight: 600; color: var(--accent-ink); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; }
.media-form[data-area="musik"] .area-film, .media-form[data-area="film"] .area-musik { display: none; }
.danger-zone { margin-top: 30px; text-align: center; }
.lookup-box { padding: 14px; }
.lookup-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lookup-row input { flex: 1 1 240px; border-radius: 99px; background: var(--bg); border-color: transparent; }
.lookup-row select { border-radius: 99px; background-color: var(--bg); border-color: transparent; }
.candidates { display: grid; gap: 0; margin-top: 10px; }
.candidate { display: flex; gap: 12px; align-items: center; padding: 10px 2px; border-top: .5px solid var(--line); }
.candidate img, .candidate .cover { width: 54px; height: 54px; object-fit: cover; border-radius: 7px; flex: none; }
.candidate .cand-body { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.candidate.busy { opacity: .5; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { flex: 1 1 160px; background-color: var(--bg); border-color: transparent; }
.inline-form select { flex: 0 1 auto; }

/* ------------------------------------------------------------ Scanner */
.scan-layout { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
.reader { width: 100%; min-height: 260px; border-radius: 18px; overflow: hidden; background: #000; color: #ddd; position: relative; }
.reader video { width: 100% !important; display: block; object-fit: cover; }
.reader-hint { display: grid; place-items: center; min-height: 260px; padding: 24px; text-align: center; font-size: .95rem; color: rgba(255, 255, 255, .7); }
.reader #qr-shaded-region { border-color: rgba(0, 0, 0, .42) !important; }
.scan-cam { position: relative; }
.cam-controls { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.manual { display: flex; gap: 8px; }
.manual input { flex: 1; font-size: 1.05rem; letter-spacing: .04em; border-radius: 99px; background: var(--surface); border-color: transparent; }
.scan-side .segmented { width: 100%; }
.scan-side .segmented button { flex: 1; }
.scan-place { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin: 12px 0; background: var(--surface);
  border-radius: var(--radius); padding: 12px; }
.scan-place label { display: grid; gap: 4px; font-size: .78rem; color: var(--muted); font-weight: 500; }
.scan-place input, .scan-place select { background-color: var(--bg); border-color: transparent; }
.inventur-only { display: none; }
body[data-mode="inventur"] .inventur-only { display: grid; }
.scan-result { margin: 12px 0; display: grid; gap: 8px; }
.scan-result h3 { margin: 4px 0 0; }
.scan-result .candidate { background: var(--surface); border-radius: var(--radius); padding: 10px 12px; border: 0; }
.known { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--ok-soft); color: var(--text); align-items: center; }
.known:hover { text-decoration: none; }
.known .cover { width: 64px; height: 64px; }
.where-inline { font-weight: 600; }
.scan-log { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.scan-log:empty { display: none; }
.scan-log li { display: flex; gap: 10px; align-items: center; padding: 9px 14px; font-size: .92rem; border-bottom: .5px solid var(--line); }
.scan-log li:last-child { border-bottom: 0; }
.scan-log li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gray); flex: none; }
.scan-log li.ok::before { background: var(--green); }
.scan-log li.known::before { background: #ff9f0a; }
.scan-log li.miss::before { background: var(--danger); }
.scan-log .cover { width: 36px; height: 36px; }
@media (max-width: 800px) {
  .scan-layout { grid-template-columns: 1fr; gap: 6px; }
  .scan-side { order: -1; }
  .scan-page h1, .scan-side .mode-help { display: none; }
  .scan-page .wrap { padding-top: 6px; }
  /* Kamera groß, Bedienelemente schweben als Glas darüber */
  .reader { min-height: 52vh; border-radius: 22px; }
  .reader video { min-height: 52vh; }
  .cam-controls { position: absolute; left: 10px; right: 10px; top: 10px; margin: 0; justify-content: space-between; z-index: 2; }
  .cam-controls .btn { background: rgba(30, 30, 32, .45); color: #fff; -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); font-size: .84rem; padding: 7px 13px; }
  .cam-controls select { background-color: rgba(30, 30, 32, .45); color: #fff; border: 0; border-radius: 99px; font-size: .84rem; }
  .manual { margin-top: 10px; }
  .scan-cam > p.muted { display: none; }
  .scan-place { margin: 8px 0 4px; }
}

/* ------------------------------------------------------------ Kategorien & Lücken */
.artist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0; margin-bottom: 22px;
  background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.artist-card { display: flex; gap: 12px; align-items: center; padding: 10px 14px; color: var(--text); line-height: 1.3;
  border-bottom: .5px solid var(--line); }
.artist-card:hover { text-decoration: none; background: var(--fill); }
.filter-input { margin-bottom: 10px; width: min(100%, 320px); border-radius: 99px; background: var(--fill); border-color: transparent; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: 56px 1fr 36px; gap: 10px; align-items: center; font-size: .9rem; }
.bar { background: var(--fill); border-radius: 99px; height: 8px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.gaps { list-style: none; padding: 0; margin: 0; }
.gaps li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: .5px solid var(--line); flex-wrap: wrap; }
.gaps li:last-child { border-bottom: 0; }
.gaps li.have { opacity: .6; }
.gaps .cover { width: 44px; height: 44px; object-fit: cover; }
.gaps.wish { background: var(--surface); border-radius: var(--radius); padding: 0 16px; }
.gaps.wish li { opacity: 1; }
.loading::after { content: " …"; }

.loan-list { list-style: none; padding: 0; margin: 0; }
.loan-list li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: .5px solid var(--line); flex-wrap: wrap; }
.loan-list li:last-child { border-bottom: 0; }
.loan-list li.overdue { background: var(--danger-soft); margin: 0 -18px; padding: 12px 18px; }
.places { list-style: none; padding: 0; margin: 0 0 18px; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.places li { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 12px 16px; border-bottom: .5px solid var(--line); }
.places li:last-child { border-bottom: 0; }
.place-edit { display: flex; gap: 6px; flex: 1 1 380px; flex-wrap: wrap; }
.place-edit input { flex: 1 1 140px; background: var(--bg); border-color: transparent; }
.place-count { min-width: 120px; }
.review-card { display: flex; gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: var(--radius);
  margin-bottom: 10px; color: var(--text); }
.review-card:hover { text-decoration: none; background: color-mix(in srgb, var(--surface) 94%, var(--text)); }

/* ------------------------------------------------------------ Login */
.login-page { padding-bottom: 0; }
.login-page main { min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(ellipse at 30% 10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
              radial-gradient(ellipse at 80% 90%, color-mix(in srgb, var(--blue) 14%, transparent), transparent 55%); }
.login-card { padding: 34px 28px; max-width: 400px; width: calc(100% - 32px); text-align: center; border-radius: 26px;
  background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-edge), 0 20px 60px rgba(0, 0, 0, .12); }
.login-card img { border-radius: 16px; }
.login-card h1 { margin: 10px 0 0; }
.login-card .btn.big { width: 100%; margin-top: 14px; }
.dev-users { display: grid; gap: 8px; }

/* ------------------------------------------------------------ Etiketten & Druck */
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, 62mm); gap: 4mm; }
.label { width: 62mm; height: 29mm; display: flex; gap: 3mm; align-items: center; padding: 2mm; border: 1px dashed #ccc;
  background: #fff; color: #000; border-radius: 2mm; overflow: hidden; }
.label svg { width: 25mm; height: 25mm; flex: none; }
.label div { display: flex; flex-direction: column; font-size: 8pt; line-height: 1.2; min-width: 0; }
.label strong { font-size: 9pt; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media print {
  .topbar, .tabdock, .no-print, .flash { display: none !important; }
  body { background: #fff; padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .label { border-color: #ccc; break-inside: avoid; }
}

/* ------------------------------------------------------------ Ohne Barcode & Stapel */
.nocode { margin: 14px 0; padding: 14px; }
.nocode h3 { margin: 0 0 10px; }
.nocode .lookup-row select { flex: 0 1 150px; }
.nocode-links { margin: 10px 2px 0; color: var(--muted); }
.bulk-label { display: block; font-size: .8rem; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.bulk-input textarea { background: var(--bg); border-color: transparent; font-size: 1rem; line-height: 1.5; }
.bulk-opts { padding: 14px 0 0; background: none; }
.bulk-rows { list-style: none; padding: 0 16px; margin: 0 0 16px; background: var(--surface); border-radius: var(--radius); }
.bulk-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: .5px solid var(--line); }
.bulk-row:last-child { border-bottom: 0; }
.bulk-row > .bulk-check { margin-top: 13px; }
.bulk-row.skipped { opacity: .55; }
.bulk-row.done .bulk-line code { background: var(--ok-soft); }
.bulk-line { margin-bottom: 6px; }
.bulk-choice { width: 100%; background-color: var(--bg); border-color: transparent; font-size: .92rem; }
.bulk-status { margin-top: 5px; font-size: .85rem; }
.bulk-save { position: sticky; bottom: calc(92px + env(safe-area-inset-bottom)); padding: 10px 0; }
@media (min-width: 1201px) { .bulk-save { bottom: 12px; } }

/* ------------------------------------------------------------ Empfehlungen */
.rec-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 14px; overflow-x: auto;
  padding: 2px 2px 10px; margin: 0 -2px 6px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.rec-card { display: flex; flex-direction: column; gap: 3px; color: var(--text); scroll-snap-align: start; font-size: .88rem; line-height: 1.28; }
.rec-card:hover { text-decoration: none; }
.rec-card .cover { margin-bottom: 4px; }
.rec-card .rec-why { font-size: .76rem; color: var(--accent-ink); }
.rec-card .shops { margin-top: 4px; }
.rec-card .btn { align-self: flex-start; margin-top: 4px; }
.recs h3:first-of-type { margin-top: .2em; }
