:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --text: #1f2421;
  --muted: #66706b;
  --border: #dedad2;
  --accent: #2f6f62;
  --accent-text: #ffffff;
  --ok: #2e7d4f;
  --warn: #b7791f;
  --fail: #c0392b;
  --ok-bg: #e6f3eb;
  --warn-bg: #fbf1de;
  --fail-bg: #fbe7e5;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151816;
    --surface: #1f2421;
    --text: #e8ebe9;
    --muted: #9aa49f;
    --border: #333a36;
    --accent: #5fb3a0;
    --accent-text: #0e1311;
    --ok: #6cc58f;
    --warn: #e5b35a;
    --fail: #ef7b6e;
    --ok-bg: #1d3326;
    --warn-bg: #3a2f1a;
    --fail-bg: #3b2220;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
code { font-size: .9em; background: var(--bg); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.topbar {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; justify-content: space-between;
  padding: .75rem 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
nav a { text-decoration: none; color: var(--text); }
nav a:hover { color: var(--accent); }
main { width: 100%; max-width: 960px; margin: 0 auto; padding: 24px 16px; flex: 1; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; align-items: end; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .95rem; }
label small { font-weight: 400; color: var(--muted); }
input, select {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); min-width: 0;
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .button {
  font: inherit; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block;
}
button.primary, .button { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--fail); border-color: var(--fail); }
button.link { border: none; background: none; padding: 0; color: var(--text); }
button.link:hover { color: var(--accent); }
form.inline { display: flex; gap: .5rem; align-items: center; margin: 0; }
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--fail-bg); color: var(--fail); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.row-between h1 { margin: 0; }
.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.check { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem .75rem; border-radius: 8px; }
.check.ok { background: var(--ok-bg); }
.check.warn { background: var(--warn-bg); }
.check.fail { background: var(--fail-bg); }
.badge { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--accent-text); }
.ok .badge { background: var(--ok); }
.warn .badge { background: var(--warn); }
.fail .badge { background: var(--fail); }
.check .muted { overflow-wrap: anywhere; }
.events { list-style: none; padding: 0; margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; overflow-wrap: anywhere; }
.events li { padding: .2rem 0; border-bottom: 1px solid var(--border); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .9rem; }
@media (max-width: 600px) {
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: .5rem; }
  td form.inline { flex-wrap: wrap; }
}

/* ---------- 0.2: Prüfbericht & Regeln ---------- */
.button.secondary, button.secondary { background: var(--surface); color: var(--accent); border-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0 0; }
.actions form { margin: 0; }
.right { text-align: right; }
.bar { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.bar > div { height: 100%; background: var(--accent); transition: width .3s; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin: .5rem 0; }
.stat { background: var(--bg); border-radius: 10px; padding: .75rem; display: flex; flex-direction: column; }
.stat .num { font-size: 1.6rem; font-weight: 700; }
.stat.bad .num { color: var(--fail); }
table.compact td { padding: .35rem .5rem; }
.letters { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; padding-bottom: .25rem; }
.letter { flex: 1 0 26px; display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text); font-size: .8rem; }
.letter .col { height: 120px; width: 100%; display: flex; align-items: flex-end; }
.letter .col span { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.letter .lbl { font-weight: 700; margin-top: 2px; white-space: nowrap; }
.letter .cnt { color: var(--muted); font-size: .7rem; }
.move { padding: .6rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.move .from { color: var(--muted); font-size: .9rem; }
.move .to { font-weight: 600; }
.move .to.same { font-weight: 400; }
.move .to.bad { color: var(--fail); }
.move .muted { display: inline-block; min-width: 4.5em; font-weight: 400; font-size: .8rem; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem .4rem; margin-top: .25rem; align-items: center; font-size: .8rem; }
.tag { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: .8rem; }
.tag.unreadable, .tag.no_artist { background: var(--fail-bg); color: var(--fail); border-color: transparent; }
.tag.duplicate, .tag.version, .tag.multi_artist, .tag.suspicious_title { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
textarea { width: 100%; font: .9rem/1.4 ui-monospace, Menlo, monospace; padding: .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); margin-bottom: 1rem; }
label.plain { font-weight: 400; display: inline; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: .75rem 0 0; margin-top: .5rem; border-top: 1px solid var(--border); }
.result { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.dup h2 { font-size: 1rem; }

/* ---------- 0.3: Bearbeiten, Papierkorb, Protokoll ---------- */
a.stat { text-decoration: none; color: var(--text); }
a.stat:hover { outline: 2px solid var(--accent); }
.stat.good .num { color: var(--ok); }
.card.highlight { border-color: var(--accent); }
button.small, .button.small { padding: .25rem .7rem; font-size: .85rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.row-actions form { margin: 0; }
details.edit { margin-top: .4rem; }
details summary { cursor: pointer; color: var(--accent); font-size: .9rem; width: fit-content; }
details.edit form { margin-top: .6rem; padding: .75rem; background: var(--bg); border-radius: 8px; }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.edit-grid label { font-size: .85rem; }
.edit-grid input { background: var(--surface); }
.edit-grid .artist, .edit-grid .sortartist, .edit-grid .title, .edit-grid .album, .edit-grid .albumartist { grid-column: span 2; }
@media (max-width: 420px) { .edit-grid .artist, .edit-grid .sortartist, .edit-grid .title, .edit-grid .album, .edit-grid .albumartist { grid-column: auto; } }
.small { font-size: .85rem; }
label.check { display: inline-flex; flex-direction: row; gap: .4rem; align-items: center; font-weight: 400; }
.dup-meta { margin-top: .75rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.batch.undone .to { color: var(--muted); }
.change-list { margin: .5rem 0 0; padding-left: 1.2rem; font-size: .85rem; overflow-wrap: anywhere; }
.change-list li { margin-bottom: .3rem; }

/* ---------- 0.4: Probehören ---------- */
details.listen { margin-top: .4rem; }
details.listen audio { display: block; width: 100%; max-width: 420px; margin-top: .4rem; }

/* ---------- 0.5: Massenbearbeitung, Cover ---------- */
.move.selectable { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .75rem; }
.move.selectable > :not(.pick) { grid-column: 2; }
.move .pick { grid-row: 1 / span 3; width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--accent); }
.bulk details summary { margin-top: .75rem; }
.bulk-grid { margin: .75rem 0; }
.bulk-field { display: flex; flex-direction: column; gap: .25rem; }
.bulk-field label { font-size: .85rem; }
.bulk label.small { margin: .75rem 0; }
.cover-edit { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; margin-top: .75rem; padding: .75rem; background: var(--bg); border-radius: 8px; }
.cover-thumb { width: 96px; height: 96px; border-radius: 8px; background: var(--surface); display: grid; place-items: center; overflow: hidden; flex: none; }
.cover-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cover-form { display: flex; flex-direction: column; gap: .4rem; flex: 1; min-width: 200px; }
.cover-form input[type=file] { font-size: .85rem; padding: .3rem; }
.cover-edit .actions { margin: 0; }

/* ---------- 0.6: Erkennung ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs a { padding: .5rem .8rem; text-decoration: none; color: var(--text); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.suggestion { padding: .9rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.suggestion .from { color: var(--muted); font-size: .9rem; margin-bottom: .4rem; }
table.compare { font-size: .9rem; margin: .3rem 0; }
table.compare th { width: 8.5rem; font-weight: 600; color: var(--muted); }
table.compare td { padding: .25rem .5rem; }
table.compare tr.diff td:last-child { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.tag.good { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
details.alternatives { margin: .5rem 0; }
label.alt { display: flex; gap: .6rem; align-items: center; padding: .35rem 0; }
label.alt img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
label.alt span { display: flex; flex-direction: column; }
audio.mini { height: 32px; max-width: 260px; }
.inline-reject { margin-top: .4rem; }

/* ---------- 0.8: Wiedergabe ---------- */
fieldset.choice { border: 1px solid var(--border); border-radius: 8px; padding: .5rem .9rem .75rem; display: flex; flex-direction: column; gap: .35rem; }
fieldset.choice legend { font-weight: 600; padding: 0 .3rem; }

/* ---------- 0.9: Hauptmenü (Burger auf schmalen Bildschirmen) ---------- */
nav a.active { color: var(--accent); font-weight: 600; }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--text); cursor: pointer; }
.menu-toggle:hover { background: var(--bg); }
.nav-scrim { display: none; }
@media (max-width: 1300px) {
  .topbar { justify-content: flex-start; gap: .5rem; }
  .menu-toggle { display: grid; place-items: center; }
  #mainnav {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(280px, 85vw);
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px; overflow-y: auto;
    padding: 16px 8px; background: var(--surface); border-right: 1px solid var(--border);
    transform: translateX(-105%); transition: transform .2s;
  }
  #mainnav.open { transform: none; box-shadow: 10px 0 30px rgba(0,0,0,.3); }
  #mainnav a, #mainnav button.link { display: block; padding: .55rem .75rem; border-radius: 8px; text-align: left; width: 100%; }
  #mainnav a:hover { background: var(--bg); }
  #mainnav a.active { background: var(--bg); }
  #mainnav .nav-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: .5rem; display: flex; flex-direction: column; gap: 2px; }
  #mainnav .account-link { display: flex; align-items: center; gap: .6rem; }
  .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .nav-scrim[hidden] { display: none; }
}

/* App-Icon: weißes Logo auf Akzentfarbe, abgerundet wie ein App-Symbol */
.app-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--icon-bg, #2f6f62); display: inline-grid; place-items: center; flex: none; }
.app-icon img { width: 76%; height: 76%; display: block; }
:root { --icon-bg: #2f6f62; }
@media (prefers-color-scheme: dark) { :root { --icon-bg: #2b6a5d; } }
pre.example { background: var(--bg); border-radius: 8px; padding: .6rem .8rem; font-size: .9rem; overflow-x: auto; }

/* ---------- Vorschläge aus dem Netz ---------- */
.online { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.online-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.online-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; max-height: 320px; overflow-y: auto; }
.online-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: .75rem; align-items: start; }
.online-cover { width: 64px; height: 64px; border-radius: 6px; overflow: hidden; background: var(--bg); display: grid; place-items: center; }
.online-cover img { width: 100%; height: 100%; object-fit: cover; }
.online-nocover { font-size: .7rem; color: var(--muted); text-align: center; }
.online-text { min-width: 0; font-size: .9rem; overflow-wrap: anywhere; }
.online-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .3rem; }
.online-actions button, .online-head button { font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.filled { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- 0.12: Avatar, Konto ---------- */
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--icon-bg); color: #fff; font-weight: 700; font-size: .9rem; line-height: 1; object-fit: cover; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.small { width: 26px; height: 26px; font-size: .8rem; }
.avatar.large { width: 72px; height: 72px; font-size: 1.8rem; }
.nav-foot { display: contents; }
.account-link { display: inline-flex; align-items: center; gap: .45rem; }
.narrow-only { display: none; }
.profile { display: flex; align-items: center; gap: 1rem; margin: .5rem 0 1rem; }
.task-buttons { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
@media (max-width: 1300px) { .wide-only { display: none; } .narrow-only { display: inline; } }
