/* Mobile-first. Desktop-Anpassungen ab 760px am Ende. */
:root {
  --bg: #f1f4f3; --card: #ffffff; --ink: #17302c; --muted: #5e7470; --line: #dbe4e2;
  --brand: #134e46; --brand-2: #2a7f74; --auction: #2a7f74; --buynow: #e4572e;
  --warn: #8a6100; --warn-bg: #fff4d6; --err: #b3261e; --err-bg: #fde4e1; --ok: #1f7a4d; --hover: #eaf1ef;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --tabbar: 58px;
}
/* Darstellung: ohne data-theme folgt die Seite dem System (Auto); data-theme="light|dark" erzwingt die Wahl. */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1b19; --card: #172623; --ink: #e5efed; --muted: #93aaa5; --line: #263a36;
    --brand: #1d6f64; --brand-2: #4fb3a5; --auction: #4fb3a5; --buynow: #ff7a52;
    --warn: #f2cf75; --warn-bg: #3a3118; --err: #ff8a80; --err-bg: #3d1f1c; --ok: #6fd6a0; --hover: #1e302d;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1b19; --card: #172623; --ink: #e5efed; --muted: #93aaa5; --line: #263a36;
    --brand: #1d6f64; --brand-2: #4fb3a5; --auction: #4fb3a5; --buynow: #ff7a52;
    --warn: #f2cf75; --warn-bg: #3a3118; --err: #ff8a80; --err-bg: #3d1f1c; --ok: #6fd6a0; --hover: #1e302d;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.2; }
h2 { font-size: 1.25rem; } h3 { font-size: 1rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .error { color: var(--err); min-height: 1.2em; margin: .2rem 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: .6rem .95rem; min-height: 44px; touch-action: manipulation; }
button:hover { background: var(--hover); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.12); }
button.ghost { background: transparent; }
button.icon { padding: 0; width: 44px; justify-content: center; display: inline-flex; align-items: center; border-radius: 50%; }
button:disabled { opacity: .5; cursor: default; }
input, select { width: 100%; min-height: 44px; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 16px; /* verhindert iOS-Zoom */ }
label { display: block; font-size: .85rem; color: var(--muted); }
label input, label select { margin-top: .2rem; color: var(--ink); }
label.check { display: flex; gap: .6rem; align-items: center; color: var(--ink); font-size: .95rem; min-height: 44px; }
label.check input { width: 22px; min-height: 22px; height: 22px; margin: 0; flex: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; }

/* Anmeldung */
.auth { position: fixed; inset: 0; z-index: 40; overflow: auto; background: var(--bg); min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(420px, 100%); }
.auth-card form { display: grid; gap: .7rem; margin-top: .8rem; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--hover); padding: 4px; border-radius: 12px; margin-top: 1rem; }
.seg button { border: 0; background: none; border-radius: 9px; }
.seg button.active { background: var(--card); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.15); }

/* Kopfzeile */
.top { position: sticky; top: 0; z-index: 10; padding: calc(.5rem + var(--sat)) 12px .6rem; background: var(--brand); color: #fff; }
.top-row { display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 700; font-size: 1.1rem; }
.pill { min-height: 38px; padding: .3rem .9rem; border-radius: 99px; background: #fff; color: var(--brand); border: 0; font-weight: 600; align-self: center; margin-right: .3rem; }
.pill:hover { background: #fff; filter: brightness(.95); }
.star { background: none; border: 0; padding: 0 .35rem 0 0; min-height: 0; font-size: 1.5rem; line-height: 1; color: var(--muted); vertical-align: -2px; }
.star:hover { background: none; color: var(--buynow); }
.star.on { color: #f2b01e; }
.home-sec { margin-top: 1.2rem; } .home-sec h3 { margin-bottom: .5rem; }
.note-card { margin-top: 12px; display: grid; gap: .6rem; }
.favs { display: grid; gap: 8px; }
.fav { display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; text-align: left; width: 100%; padding: .75rem .9rem; border-radius: 14px; }
.fav b { font-size: 1rem; } .fav .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.fav .s { color: var(--muted); font-size: .82rem; }
.tag { display: inline-block; padding: 0 .45rem; border-radius: 99px; font-size: .72rem; border: 1px solid var(--line); margin-left: .3rem; color: var(--muted); }
.tag.hit { color: #fff; background: var(--ok); border-color: var(--ok); }
.top-actions { display: flex; gap: .2rem; }
.top button.icon { color: #fff; border: 0; background: transparent; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--hover); padding: 4px; border-radius: 12px; }
.seg3 button { border: 0; background: none; border-radius: 9px; }
.seg3 button.active { background: var(--card); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.top button.icon:hover { background: rgba(255,255,255,.16); }
.search { display: flex; gap: .5rem; margin-top: .4rem; }
.search input { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.35); color: #fff; }
.search input::placeholder { color: rgba(255,255,255,.72); }
.search .primary { background: #fff; color: var(--brand); border-color: #fff; flex: none; }
.search-box { position: relative; flex: 1; min-width: 0; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 4px; list-style: none; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.28); max-height: min(60dvh, 420px); overflow: auto; }
.sugg li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .6rem .7rem; min-height: 44px; border-radius: 8px; cursor: pointer; }
.sugg li.active, .sugg li:hover { background: var(--hover); }
.sugg li b { font-weight: 700; }
.sugg li .n { flex: none; font-size: .75rem; color: var(--ok); border: 1px solid var(--ok); border-radius: 99px; padding: 0 .45rem; }
.sugg li .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.banner { margin: 12px 12px 0; padding: .8rem 1rem; border-radius: 12px; background: var(--warn-bg); color: var(--warn); display: grid; gap: .6rem; }
.banner.err { background: var(--err-bg); color: var(--err); }
.banner .primary { justify-self: start; }

.content { padding: 12px 12px calc(var(--tabbar) + 24px + var(--sab)); max-width: 1100px; margin: 0 auto; }
.empty { text-align: center; padding: 2rem 1rem; }
.recent { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1rem; }
.recent button { border-radius: 99px; }
.result-head { display: grid; gap: .6rem; margin-bottom: .5rem; }
.head-actions { display: flex; gap: .5rem; }
.head-actions button { flex: 1; }
.progress { padding: .7rem .9rem; border-radius: 12px; background: var(--hover); margin-bottom: .6rem; font-size: .92rem; }
.bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: .5rem; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 30%; background: var(--brand-2); animation: slide 1.2s infinite ease-in-out; }
.bar.det > i { animation: none; margin-left: 0; transition: width .6s ease; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

/* Zustandsauswahl: horizontal scrollbar, klebt unter dem Kopf */
.condbar { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem 0 .7rem; margin: 0 -12px; padding-inline: 12px; scrollbar-width: none; }
.condbar::-webkit-scrollbar { display: none; }
.cchip { flex: none; display: grid; gap: 0; text-align: left; padding: .45rem .9rem; border-radius: 14px; min-width: 84px; }
.cchip b { font-size: .95rem; } .cchip span { font-size: .78rem; color: var(--muted); }
.cchip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.cchip.active span { color: rgba(255,255,255,.8); }

/* Werte */
.hero { text-align: center; padding: 1.1rem 1rem; }
.hero .big { font-size: 2.6rem; font-weight: 800; line-height: 1.1; }
.hero .sub { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1rem; margin-top: .5rem; color: var(--muted); font-size: .9rem; }
.hero .sub b { color: var(--ink); }
.stack { display: grid; gap: 12px; }
.delta-up { color: var(--ok); } .delta-down { color: var(--err); }
.vt { width: 100%; border-collapse: collapse; }
.vt th { font-weight: 600; font-size: .9rem; text-align: right; padding: 0 0 .5rem; }
.vt th:first-child { text-align: left; }
.vt td { padding: .55rem 0; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.vt td:first-child { text-align: left; color: var(--muted); font-size: .9rem; }
.vt td + td, .vt th + th { padding-left: .6rem; }
.vt tr.mm td + td { font-size: .8rem; white-space: nowrap; }
.vt tr.main td { font-size: 1.2rem; font-weight: 700; color: var(--ink); border-top: 0; }
.dot { width: .65rem; height: .65rem; border-radius: 50%; display: inline-block; margin-right: .3rem; }
.condlist { display: grid; }
.crow { display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; padding: .7rem .2rem; border-top: 1px solid var(--line); text-align: left; background: none; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; min-height: 56px; }
.crow:first-child { border-top: 0; }
.crow b { font-size: 1rem; } .crow .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.crow .s { color: var(--muted); font-size: .82rem; } .crow.active { background: var(--hover); }
.notes { margin-top: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
button.chip { min-height: 36px; padding: .2rem .8rem; border-radius: 99px; }
button.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.linkbtn { display: inline; min-height: 0; padding: .1rem .5rem; margin-left: .3rem; border-radius: 99px; font-size: .78rem; background: var(--hover); }

/* Charts */
.charts { display: grid; gap: 12px; }
.chart-wrap { position: relative; height: 240px; margin-top: .4rem; }
.chart-card.wide .chart-wrap { height: 280px; }

/* Artikel */
.item-tools { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.item-tools .muted { grid-column: 1 / -1; }
.items { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 56px 1fr auto; gap: .7rem; align-items: center; padding: .6rem .7rem; }
.item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--hover); }
.item .t { font-weight: 600; font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); text-decoration: none; }
.item .p { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 0 .45rem; border-radius: 99px; font-size: .72rem; border: 1px solid var(--line); margin-right: .3rem; }
.badge.auction { color: var(--auction); border-color: var(--auction); }
.badge.buy_now, .badge.best_offer { color: var(--buynow); border-color: var(--buynow); }

/* Angebote (Konkurrenz) */
.rb { position: relative; height: 16px; margin: 3rem .4rem 2.8rem; border-radius: 8px; background: var(--hover); }
.rb .band { position: absolute; top: 0; bottom: 0; border-radius: 8px; background: var(--brand-2); opacity: .8; }
.rb .tick { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--ink); border-radius: 2px; }
.rb .sold { position: absolute; top: -9px; width: 0; height: 0; margin-left: -7px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 11px solid var(--buynow); }
.rb .you { position: absolute; top: -9px; bottom: -9px; width: 3px; margin-left: -1px; background: #f2b01e; border-radius: 2px; box-shadow: 0 0 0 2px rgba(242,176,30,.25); }
.rb .lbl { position: absolute; top: 22px; transform: translateX(-50%); font-size: .7rem; color: var(--muted); white-space: nowrap; text-align: center; line-height: 1.15; }
.rb .lbl b { display: block; color: var(--ink); font-size: .78rem; }
.rb .lbl.top { top: -34px; color: var(--buynow); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .78rem; color: var(--muted); margin-top: .4rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.tiers { display: grid; gap: .5rem; margin-top: .6rem; }
.tier { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .7rem; align-items: center; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 12px; }
.tier .ic { font-size: 1.3rem; } .tier b { font-size: .95rem; } .tier small { grid-column: 2; color: var(--muted); font-size: .8rem; }
.tier .v { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; grid-row: 1 / span 2; grid-column: 3; }
.myprice { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end; margin-top: .8rem; }
.verdict { margin-top: .5rem; padding: .6rem .8rem; border-radius: 10px; background: var(--hover); font-size: .92rem; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin: 1rem 0 .5rem; }
.sec-head h3 { margin: 0; }

/* Untere Tab-Leiste */
.tabbar { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar) + var(--sab)); padding-bottom: var(--sab); background: var(--card); border-top: 1px solid var(--line); }
.tabbar button { border: 0; border-radius: 0; background: none; display: grid; place-items: center; gap: 0; padding: .35rem 0; color: var(--muted); font-size: .72rem; min-height: var(--tabbar); }
.tabbar button.active { color: var(--brand-2); font-weight: 700; }

/* Dialoge = Bottom-Sheets */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--card); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog.sheet { width: 100%; max-width: none; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92dvh; }
dialog.sheet.full { height: 100dvh; max-height: none; border-radius: 0; margin: 0; width: 100%; }
dialog[open] { display: flex; flex-direction: column; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: calc(.5rem + var(--sat)) .6rem .5rem 1rem; border-bottom: 1px solid var(--line); margin: 0; flex: none; }
.dlg-head h2 { margin: 0; }
.dlg-head .icon { border: 0; background: none; }
.dlg-body { padding: 1rem 1rem calc(1.5rem + var(--sab)); display: grid; gap: 1rem; overflow: auto; align-content: start; flex: 1; }
.dlg-body section { display: grid; gap: .7rem; }
.dlg-body hr { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row button { flex: none; }
.note { padding: .7rem .8rem; border-radius: 10px; background: var(--hover); font-size: .88rem; color: var(--muted); }
code { background: var(--hover); padding: .05rem .35rem; border-radius: 5px; font-size: .85em; word-break: break-all; }
table.plain { width: 100%; border-collapse: collapse; font-size: .9rem; } table.plain td { padding: .4rem .2rem; border-top: 1px solid var(--line); }

/* eBay-Login-Fenster: Bild füllt den Platz, Eingabe bleibt immer sichtbar */
.el-body { display: flex; flex-direction: column; gap: .6rem; overflow: hidden; padding-bottom: calc(.8rem + var(--sab)); }
.el-body > p { margin: 0; }
.el-frame { position: relative; flex: 1; min-height: 180px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; width: 100%; max-width: 520px; margin-inline: auto; }
.el-frame img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; user-select: none; -webkit-user-drag: none; object-fit: contain; background: #fff; cursor: pointer; }
.el-msg { position: absolute; inset: auto 0 0 0; padding: .5rem .8rem; background: rgba(19,78,70,.92); color: #fff; font-size: .85rem; }
.el-msg:empty { display: none; }
.el-form { display: grid; grid-template-columns: 1fr auto; gap: .5rem; width: 100%; max-width: 520px; margin-inline: auto; }
.el-keys { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.el-keys button { padding: .3rem .7rem; min-height: 40px; }

.toast { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + var(--sab) + 14px); max-width: calc(100vw - 24px); padding: .7rem 1rem; border-radius: 12px; background: #17302c; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.3); font-size: .92rem; }

/* Desktop */
@media (min-width: 760px) {
  .top { display: flex; align-items: center; gap: 1rem; padding: .7rem 16px; }
  .top-row { flex: none; gap: 1.5rem; }
  .top-actions { order: 3; margin-left: auto; }
  .search { flex: 1; max-width: 720px; margin: 0; }
  .top-row { display: contents; }
  .brand { order: 0; } .search { order: 1; }
  .content { padding: 16px 16px 40px; }
  #app { display: flex; flex-direction: column; min-height: 100dvh; }
  #app > .top { order: 0; } #app > .banner { order: 1; } #app > .tabbar { order: 2; } #app > .content { order: 3; width: 100%; }
  .tabbar { position: sticky; top: 64px; bottom: auto; width: 100%; height: 48px; padding: 0; grid-template-columns: repeat(4, 120px); border: 0; border-bottom: 1px solid var(--line); background: transparent; z-index: 5; max-width: 1100px; margin: 0 auto; }
  .tabbar button { grid-auto-flow: column; justify-content: center; gap: .4rem; font-size: .92rem; min-height: 48px; border-bottom: 3px solid transparent; }
  .tabbar button.active { border-bottom-color: var(--brand-2); }
  .result-head { grid-template-columns: 1fr auto; align-items: start; }
  .head-actions button { flex: none; }
  .condbar { margin: 0; padding-inline: 0; flex-wrap: wrap; overflow: visible; }
  .hero .big { font-size: 3.2rem; }
  .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-card.wide { grid-column: 1 / -1; }
  .stack.two { grid-template-columns: 1fr 1fr; align-items: start; }
  .item-tools { grid-template-columns: auto auto 1fr; } .item-tools .muted { grid-column: auto; align-self: center; }
  dialog.sheet { width: min(560px, calc(100vw - 24px)); margin: auto; border-radius: 16px; max-height: 88dvh; }
  dialog.sheet.full { height: 90dvh; max-height: 90dvh; border-radius: 16px; width: min(640px, calc(100vw - 24px)); margin: auto; }
  .toast { bottom: 24px; }
}
