:root {
  color-scheme: light;
  --bg: #f4f3f0;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e0da;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7a7974;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --grid: #e6e4df;
  --good: #0a8a0a;
  --critical: #c83434;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .05);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #141413;
    --surface-1: #1a1a19;
    --surface-2: #232321;
    --border: #2f2f2c;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --grid: #2b2b29;
    --good: #2fb52f;
    --critical: #e66767;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141413; --surface-1: #1a1a19; --surface-2: #232321; --border: #2f2f2c;
  --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #8f8e86;
  --accent: #3987e5; --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --grid: #2b2b29;
  --good: #2fb52f; --critical: #e66767; --shadow: 0 1px 2px rgb(0 0 0 / .4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text-primary);
  font: 15px/1.45 var(--font); font-variant-numeric: tabular-nums;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--text-secondary); }
.small { font-size: 13px; }
.hint { font-size: 13px; color: var(--text-muted); margin: 8px 0 0; }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }

/* ---------- Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--text-primary); }
.brand:hover { text-decoration: none; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a {
  padding: 6px 12px; border-radius: 999px; color: var(--text-secondary); font-weight: 500;
}
.tabs a:hover { text-decoration: none; background: var(--surface-2); }
.tabs a.active { background: var(--text-primary); color: var(--bg); }
@media (max-width: 560px) {
  .brand span { display: none; }
  .tabs { margin-left: 0; flex: 1; justify-content: flex-end; }
  .tabs a { padding: 6px 10px; font-size: 14px; }
  .tabs a[data-nav="einstellungen"] { font-size: 0; padding: 6px 10px; }
  .tabs a[data-nav="einstellungen"]::before { content: "⚙︎"; font-size: 18px; line-height: 1; }
}

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 64px; outline: none; }
.banner {
  max-width: 1080px; margin: 12px auto 0; padding: 10px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 14px;
  width: calc(100% - 32px);
}
.banner.error { border-color: var(--critical); }

/* ---------- Bausteine */
.panel {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin-right: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-1); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--critical); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 8px; color: var(--text-secondary); }
.icon-btn:hover { background: var(--surface-2); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-secondary); font-weight: 500; font-size: 14px;
}
.seg button.active { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow); }

input[type="text"], input[type="search"], input[type="number"], input[type="date"], select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-1); min-height: 42px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.up { color: var(--good); }
.down { color: var(--critical); }
.delta { font-weight: 600; white-space: nowrap; }

/* ---------- Sammlung */
.hero { display: grid; grid-template-columns: 1fr; gap: 16px; }
.hero-value { font-size: 40px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.05; }
.hero-meta { display: flex; gap: 8px 20px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.kpi .label { font-size: 13px; color: var(--text-secondary); }
.kpi .value { font-size: 20px; font-weight: 700; margin-top: 2px; }
.kpi .sub { font-size: 13px; color: var(--text-secondary); }

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-empty {
  display: grid; place-items: center; text-align: center; min-height: 160px; padding: 16px;
  color: var(--text-secondary); font-size: 14px; background: var(--surface-2); border-radius: 12px;
}
.chart-tip {
  position: absolute; pointer-events: none; z-index: 2; min-width: 140px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; font-size: 13px; box-shadow: var(--shadow); white-space: nowrap;
}
.chart-tip .tip-date { color: var(--text-secondary); margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; }
.chart-tip .tip-row b { margin-left: auto; padding-left: 12px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); }
.swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.swatch.dashed { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar select { width: auto; min-height: 36px; padding: 6px 10px; }

.holdings { list-style: none; margin: 0; padding: 0; }
.holding {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 4px; border-top: 1px solid var(--border); cursor: pointer; border-radius: 8px;
}
.holding:first-child { border-top: 0; }
.holding:hover { background: var(--surface-2); }
.thumb {
  width: 52px; height: 72px; border-radius: 4px; object-fit: contain; background: var(--surface-2);
  display: grid; place-items: center; font-size: 24px; overflow: hidden;
}
.thumb.sealed { height: 52px; border-radius: 10px; }
.holding .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.holding .sub { font-size: 13px; color: var(--text-secondary); }
.holding .num { text-align: right; }
.holding .num .v { font-weight: 700; }
.holding .num .s { font-size: 13px; color: var(--text-secondary); }
.tag {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-secondary); margin-left: 4px; vertical-align: 1px;
}
.empty { text-align: center; padding: 40px 16px; }
.empty .big { font-size: 44px; }

/* ---------- Suche */
.search-bar { display: grid; grid-template-columns: 1fr minmax(140px, 260px); gap: 8px; }
@media (max-width: 560px) { .search-bar { grid-template-columns: 1fr; } }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.card-tile {
  display: flex; flex-direction: column; gap: 6px; color: inherit; padding: 8px;
  border-radius: 12px; background: var(--surface-1); border: 1px solid var(--border);
}
.card-tile:hover { text-decoration: none; border-color: var(--accent); }
.card-tile .img {
  aspect-ratio: 63 / 88; border-radius: 6px; background: var(--surface-2); overflow: hidden;
  display: grid; place-items: center; color: var(--text-muted); font-size: 12px; text-align: center;
}
.card-tile .img img { width: 100%; height: 100%; object-fit: cover; }
.card-tile .name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.card-tile .meta { font-size: 12px; color: var(--text-secondary); }
.card-tile .price { font-weight: 700; font-size: 14px; }
.card-tile .price .muted { font-weight: 400; font-size: 12px; }
.list { display: grid; gap: 8px; }
.list-item {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; color: inherit;
  padding: 10px 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
}
.list-item:hover { text-decoration: none; border-color: var(--accent); }
.list-item .icon { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 22px; }
.list-item .t { font-weight: 600; }
.list-item .s { font-size: 13px; color: var(--text-secondary); }
.list-item .p { text-align: right; font-weight: 700; }
.list-item .p .s { font-weight: 400; }

/* ---------- Detail */
.detail { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } }
.detail-img { width: 100%; border-radius: 14px; box-shadow: var(--shadow); background: var(--surface-2); }
@media (max-width: 760px) { .detail-img { max-width: 260px; margin: 0 auto; display: block; } }
.detail-sealed-icon { aspect-ratio: 1; display: grid; place-items: center; font-size: 96px; background: var(--surface-2); border-radius: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface-1); border-radius: 999px;
  padding: 6px 12px; cursor: pointer; font-size: 14px; text-align: left;
}
.chip b { margin-left: 6px; }
.chip.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stat .label { font-size: 12px; color: var(--text-secondary); }
.stat .value { font-weight: 700; font-size: 17px; }
.back { display: inline-block; margin-bottom: 12px; font-size: 14px; }

/* ---------- Einstellungen */
.radio-list { display: grid; gap: 8px; }
.radio-list label {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); cursor: pointer;
}
.radio-list input { margin-top: 3px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--text-secondary); }
dl.facts dd { margin: 0; }
pre.code {
  background: var(--surface-2); padding: 10px 12px; border-radius: 10px; overflow-x: auto;
  font: 13px/1.5 var(--mono); white-space: pre;
}

/* ---------- Dialog */
dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(560px, calc(100% - 24px));
  background: var(--surface-1); color: var(--text-primary); box-shadow: 0 20px 60px rgb(0 0 0 / .3);
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog form { padding: 18px; }
.dialog-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.dialog-head > div { flex: 1; min-width: 0; }
.dialog-head p { margin: 2px 0 0; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.dialog-foot { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text-primary); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; font-weight: 500;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { color: var(--text-secondary); padding: 24px 0; text-align: center; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .toast { transition: none; } }
.img-missing { display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); font-size: 11px; text-align: center; }
.detail-img.img-missing { aspect-ratio: 63 / 88; font-size: 14px; }
.card-tile .img .img-missing { width: 100%; height: 100%; }

/* ---------- Anmeldung & Konto */
.logged-out .tabs { display: none; }
.auth { max-width: 440px; margin: 24px auto 0; }
.auth-card { padding: 24px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card p { margin: 0; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
input[type="email"], input[type="password"] {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-1); min-height: 42px;
}
.auth-links { display: flex; gap: 8px 20px; flex-wrap: wrap; justify-content: space-between; font-size: 14px; }
.form-error { color: var(--critical); margin: 0; font-size: 14px; font-weight: 500; }
.form-ok { color: var(--good); margin: 0; font-size: 14px; font-weight: 500; }
.stack.narrow { max-width: 360px; gap: 10px; }
details > summary { cursor: pointer; font-weight: 600; }
details > summary + * { margin-top: 10px; }

/* ---------- Verwaltung */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.checks .mark {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--good);
}
.checks .todo .mark { background: var(--critical); }

/* ---------- Fußzeile & Rechtsseiten */
.site-footer {
  max-width: 1080px; margin: 0 auto; padding: 16px 16px 32px; text-align: center;
  font-size: 13px; color: var(--text-muted);
}
.site-footer p { margin: 6px 0 0; }
.site-footer a { color: var(--text-secondary); }
main { padding-bottom: 32px; }
.legal { max-width: 760px; }
.legal h1 { margin: 8px 0 16px; }
.legal h2 { margin: 24px 0 8px; }
.legal h3 { margin: 16px 0 4px; }
.legal p, .legal li { color: var(--text-secondary); }
.legal .banner { width: auto; margin: 0 0 16px; }
mark.missing { background: var(--critical); color: #fff; padding: 1px 6px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Abmelden, Bearbeiten, Set-Übersicht */
.tabs button { border: 0; background: transparent; cursor: pointer; padding: 6px 12px; border-radius: 999px; color: var(--text-secondary); font-weight: 500; }
.tabs button:hover { background: var(--surface-2); }
.small-btn { padding: 3px 10px; font-size: 12px; margin-top: 4px; }
.set-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.card-tile .set-img { aspect-ratio: 16 / 9; }
.card-tile .set-img img.set-logo { object-fit: contain; padding: 10px; }
@media (max-width: 560px) { .tabs button { padding: 6px 8px; font-size: 14px; } }

/* ---------- Sortierung, Sealed-Kacheln, Grading */
.search-bar.three { grid-template-columns: 1fr minmax(140px, 220px) minmax(140px, 220px); }
.search-bar.four { grid-template-columns: 1fr repeat(3, minmax(130px, 200px)); }
@media (max-width: 860px) { .search-bar.three, .search-bar.four { grid-template-columns: 1fr 1fr; } .search-bar input[type=search] { grid-column: 1 / -1; } }
@media (max-width: 480px) { .search-bar.three, .search-bar.four { grid-template-columns: 1fr; } }
.price-skeleton { display: inline-block; width: 60px; height: 14px; }
.sealed-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card-tile .sealed-img { aspect-ratio: 1; }
.sealed-pic { width: 100%; height: 100%; }
.card-tile .img img.photo, img.thumb.photo { object-fit: contain; background: #fff; }
.logo-fallback, .icon-fallback { position: relative; display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.logo-fallback img { width: 100%; height: 100%; object-fit: contain; padding: 12%; }
.card-tile .img .logo-fallback img { object-fit: contain; }
.logo-fallback .badge { position: absolute; right: 4px; bottom: 2px; font-size: 20px; line-height: 1; }
.thumb.logo-fallback img { padding: 4px; }
.thumb.logo-fallback .badge { font-size: 13px; right: 1px; bottom: 0; }
.icon-fallback { font-size: 48px; }
.thumb.icon-fallback { font-size: 24px; }
.detail-sealed-icon.logo-fallback .badge { font-size: 40px; right: 12px; bottom: 8px; }
.tag.grade { background: var(--accent); color: var(--accent-ink); }
[hidden] { display: none !important; }
.detail-sealed-icon.icon-fallback { font-size: 96px; }
#confirm-dialog { max-width: 420px; padding: 18px; }
#confirm-dialog p { margin: 0 0 16px; font-weight: 600; }

/* ====================================================================== Überarbeitung für Handy und Bedienung */

/* ---------- Navigation: oben am Schreibtisch, unten am Handy */
.tabs a { position: relative; }
.nav-dot {
  position: absolute; top: 4px; right: 2px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--critical); box-shadow: 0 0 0 2px var(--bg);
}
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .topbar { padding-bottom: 8px; }
  .brand span { display: inline; }
  .topbar .tabs { display: none; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface-1) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav a {
    position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; min-height: 50px;
    color: var(--text-muted); font-size: 11px; font-weight: 600; border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav svg {
    width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .bottom-nav a.active svg { stroke-width: 2.2; }
  .bottom-nav .nav-dot { top: 4px; right: calc(50% - 16px); box-shadow: 0 0 0 2px var(--surface-1); }
  .logged-out .bottom-nav { display: none; }
  body:not(.logged-out) main { padding-bottom: 24px; }
  body:not(.logged-out) .site-footer { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  body:not(.logged-out) .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  main { padding-top: 14px; }
  /* iOS zoomt bei Schrift unter 16px in Eingabefelder hinein */
  input, select, textarea { font-size: 16px !important; }
  .btn { min-height: 44px; }
  .seg button { min-height: 36px; }
}

/* ---------- Schaltflächen und Kleinteile */
.btn.block { width: 100%; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 13px; }
.icon-btn { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; }
.link-row { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text-secondary); white-space: nowrap;
}
.pill.up { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.pill.down { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }
.tag.source { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.tag.ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.toast { display: flex; align-items: center; gap: 12px; pointer-events: none; }
.toast.show { pointer-events: auto; }
.toast button {
  border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; padding: 4px 2px;
}
:root:not([data-theme="dark"]) .toast button { color: #8ec2ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast button { color: #1f66c2; } }

/* ---------- Sammlung */
.hero-value { font-size: clamp(34px, 9vw, 46px); }
.hero-meta { align-items: center; gap: 8px; }
.hero-meta .when { color: var(--text-muted); font-size: 13px; }
.holding { grid-template-columns: 52px minmax(0, 1fr) auto; padding: 10px 6px; }
.holding .title { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.holding .title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.holding .tag { margin-left: 0; }
.holding .num { display: grid; justify-items: end; gap: 2px; }
.holding .edit {
  border: 1px solid var(--border); background: var(--surface-1); border-radius: 10px; cursor: pointer;
  min-width: 40px; min-height: 36px; padding: 0 10px; font-size: 13px; font-weight: 600; color: var(--text-secondary);
}
.holding .edit:hover { background: var(--surface-2); color: var(--text-primary); }
.toolbar { gap: 8px 12px; }
.toolbar select { min-height: 40px; }
.empty .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* ---------- Suche und Kacheln */
.search-head { position: sticky; top: 49px; z-index: 5; background: var(--bg); padding: 8px 0; margin: -8px 0; }
@media (max-width: 760px) {
  .search-head { top: calc(47px + env(safe-area-inset-top)); }
  .search-bar.three, .search-bar.four { grid-template-columns: 1fr 1fr; gap: 8px; }
  .search-bar select { min-height: 42px; padding: 8px 10px; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-cards.set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) and (min-width: 520px) { .grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card-tile { position: relative; }
.card-tile .img { position: relative; }
.owned-badge {
  position: absolute; left: 6px; top: 6px; z-index: 1; padding: 2px 8px; border-radius: 999px;
  background: var(--good); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 1px 4px rgb(0 0 0 / .35);
}
.quick-add {
  position: absolute; right: 6px; bottom: 6px; z-index: 1; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--accent); color: var(--accent-ink); font-size: 24px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 2px 8px rgb(0 0 0 / .35);
}
.quick-add:hover { filter: brightness(1.1); }
.quick-add:disabled { opacity: .6; }
.card-tile.missing .img img { filter: grayscale(.85) opacity(.55); }
.card-tile.missing:hover .img img { filter: none; }

/* ---------- Fortschritt */
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); min-width: 2px; }
.progress.done > span { background: var(--good); }
.set-progress { display: grid; gap: 10px; }
.set-progress .figures { display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: baseline; }
.set-progress .figures b { font-size: 20px; }
.progress-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.progress-item {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: center; color: inherit;
  padding: 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px;
}
.progress-item:hover { text-decoration: none; border-color: var(--accent); }
.progress-item .logo {
  height: 52px; display: grid; place-items: center; background: var(--surface-2); border-radius: 10px;
  font-size: 11px; text-align: center; color: var(--text-muted); overflow: hidden; padding: 4px;
}
.progress-item .logo img { max-height: 44px; object-fit: contain; }
.progress-item .t { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.progress-item .s { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ---------- Detailseite */
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 760px) {
  .action-bar {
    position: fixed; left: 0; right: 0; bottom: calc(63px + env(safe-area-inset-bottom)); z-index: 15;
    padding: 10px 16px; background: color-mix(in srgb, var(--surface-1) 94%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border);
    flex-wrap: nowrap;
  }
  .action-bar .btn.primary { flex: 1; }
  .action-bar .btn.wide-only { display: none; }
  .has-action-bar { padding-bottom: 72px; }
  .detail-img { max-width: 220px; }
}
.estimate {
  background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--text-secondary);
}
.estimate b { color: var(--text-primary); font-size: 15px; }

/* ---------- Dialoge: am Handy als Blatt von unten */
dialog form { display: flex; flex-direction: column; max-height: min(88dvh, 760px); padding: 0; }
.dialog-head { padding: 16px 18px 0; margin-bottom: 12px; }
.dialog-body { padding: 0 18px; overflow-y: auto; overscroll-behavior: contain; }
.dialog-foot { padding: 12px 18px 16px; margin-top: 4px; }
#confirm-dialog .dialog-foot { padding: 0; }
dialog details { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
dialog details > summary { font-size: 14px; }
dialog details > summary .muted { font-weight: 400; }
.stepper { display: grid; grid-template-columns: 42px 1fr 42px; gap: 6px; }
.stepper button {
  border: 1px solid var(--border); background: var(--surface-1); border-radius: 10px; font-size: 20px; cursor: pointer;
  min-height: 42px;
}
.stepper input { text-align: center; }
@media (max-width: 560px) {
  dialog {
    margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 20px 20px 0 0; border-width: 1px 0 0;
  }
  dialog form { max-height: 90dvh; }
  .dialog-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
  .dialog-foot .btn.primary { flex: 1; }
  #confirm-dialog { padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); }
  #confirm-dialog .dialog-foot { border-top: 0; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2 { grid-column: span 2; }
}

/* ---------- Wunschliste */
.wish { grid-template-columns: 52px minmax(0, 1fr) auto; }
.wish .target { font-size: 13px; color: var(--text-secondary); }

/* ---------- Import */
.dropzone {
  display: grid; gap: 8px; justify-items: center; text-align: center; padding: 28px 16px;
  border: 2px dashed var(--border); border-radius: 14px; background: var(--surface-2); cursor: pointer;
}
.dropzone.over { border-color: var(--accent); }
.dropzone input { display: none; }
.import-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.import-rows { list-style: none; margin: 0; padding: 0; }
.import-rows li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 10px 2px; border-top: 1px solid var(--border); font-size: 14px;
}
.import-rows li:first-child { border-top: 0; }
.import-rows .mark {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  color: #fff; background: var(--good);
}
.import-rows .error .mark { background: var(--critical); }
.import-rows .duplicate .mark { background: var(--text-muted); }
.import-rows .s { font-size: 13px; color: var(--text-secondary); }
.import-rows .error .s { color: var(--critical); }
textarea {
  width: 100%; min-height: 120px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-1); font: 13px/1.5 var(--mono); color: inherit; resize: vertical;
}
ol.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-secondary); }

/* Bearbeiten-Knopf: am Handy als Stift-Symbol, damit der Text der Position Platz hat */
@media (max-width: 560px) {
  .holding .edit .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .holding .edit::before { content: "✎"; font-size: 17px; }
  .holding .edit { min-width: 44px; min-height: 40px; padding: 0; }
  .holding { gap: 10px; }
}
.progress-item .t span:last-child { white-space: nowrap; flex: none; }
.progress-item .t span:first-child { overflow: hidden; text-overflow: ellipsis; }
.kpi .value .delta { white-space: normal; font-size: 17px; line-height: 1.25; display: inline-block; }
.tag.warn { background: color-mix(in srgb, var(--critical) 16%, transparent); color: var(--critical); }
