/* Mobile first, dark first. No framework. */
:root {
  --bg: #121417;
  --card: #1c1f24;
  --line: #2c3139;
  --text: #e8eaed;
  --muted: #9aa1ab;
  --accent: #4fb37a;
  --accent-text: #08140d;
  --warn: #e0a640;
  --error: #ef6461;
  --info: #5aa9e6;
  --radius: 14px;
  --touch: 48px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7; --card: #ffffff; --line: #dde1e6; --text: #15181c; --muted: #5d6570;
    --accent: #1f8a4c; --accent-text: #ffffff; color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.sprite { display: none; }
svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--info); }
h1 { font-size: 1.4rem; margin: 0 0 .6rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 48px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.big { font-size: 2rem; font-weight: 700; margin: .2rem 0; display: flex; gap: .4rem;
  justify-content: center; align-items: center; }
.price .big { justify-content: flex-start; }

.bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { color: var(--text); font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.tools { display: flex; gap: 4px; align-items: center; }
.tools form { margin: 0; }

.icon, .btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: var(--touch); min-width: var(--touch); border-radius: 12px; cursor: pointer;
  font: inherit; text-decoration: none; }
.icon { background: transparent; border: 0; color: var(--text); padding: 0; }
.btn { background: var(--card); color: var(--text); border: 1px solid var(--line); padding: 0 16px; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; }
.icon.danger { color: var(--error); }
.icon-btn { padding: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 14px; }
.card.center { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.flash { padding: 10px 12px; border-radius: 10px; margin: 0 0 12px; border-left: 4px solid var(--info);
  background: color-mix(in srgb, var(--info) 14%, transparent); }
.flash.error { border-color: var(--error); background: color-mix(in srgb, var(--error) 14%, transparent); }
.flash.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }

label { display: block; margin: 0 0 12px; font-weight: 600; font-size: .95rem; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; min-height: var(--touch);
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font: inherit; font-weight: 400; }
textarea { resize: vertical; }
input[type=checkbox] { width: 28px; height: 28px; min-height: 0; margin: 0; accent-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row > label, .row > input { flex: 1; }
.counter { float: right; color: var(--muted); font-weight: 400; }
.counter.over { color: var(--warn); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions form { margin: 0; }

.new { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.new .drop { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 96px; margin: 0; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; }
.new .drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.new input[type=text] { margin: 0; }
.new.sending { opacity: .6; }
[data-count].over { color: var(--error); }

.drafts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.drafts a { display: flex; gap: 12px; padding: 10px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); text-decoration: none; }
.drafts img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; flex: none; background: var(--line); }
.drafts .info { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.drafts strong { width: 100%; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem;
  background: var(--line); color: var(--text); font-weight: 600; }
.s-working, .p-posting { background: color-mix(in srgb, var(--info) 30%, transparent); }
.s-failed, .p-failed { background: color-mix(in srgb, var(--error) 35%, transparent); }
.s-draft { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.p-posted { background: var(--accent); color: var(--accent-text); }
.p-filled { background: color-mix(in srgb, var(--warn) 40%, transparent); }
.sold-b { background: var(--warn); color: #1c1300; }

.photos { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 10px;
  padding: 0 16px; }
.photos img { height: 220px; width: auto; max-width: 85vw; object-fit: cover; border-radius: 12px; scroll-snap-align: start; }
.status-line { display: flex; gap: 8px; align-items: center; }

.market { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.market:first-of-type { border-top: 0; padding-top: 0; }
.market-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.shot img { display: block; width: 100%; border-radius: 10px; border: 1px solid var(--line); margin: 6px 0; }

.pair { display: flex; gap: 20px; margin: 8px 0 0; }
.pair dt { color: var(--muted); font-size: .85rem; }
.pair dd { margin: 0; font-weight: 700; font-size: 1.2rem; }
.questions ul { margin: 0; padding-left: 1.2rem; }

.grid { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.comp { display: flex; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.comp.off { opacity: .5; }
.comp.m-different { border-style: dashed; }
.pick { position: relative; margin: 0; flex: none; }
.pick input { position: absolute; top: 4px; left: 4px; }
.pick img, .noimg { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: var(--line); }
.comp-body { min-width: 0; }
.comp-body a { color: var(--text); font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.comp-body p { margin: 4px 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.verdict { font-size: .9rem; }
.v-same_variant { color: var(--accent); }
.v-same_model { color: var(--info); }
.v-different { color: var(--error); }

.danger-zone { display: flex; justify-content: flex-end; }
.users { list-style: none; padding: 0; margin: 0; }
.users li { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--line); padding: 6px 0; }
.users form { margin: 0; }
.code { font: 12px/1.4 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-all; }
pre.code { background: var(--bg); padding: 10px; border-radius: 10px; overflow-x: auto; }
svg.ok { color: var(--accent); width: 36px; height: 36px; }
button.done { border-color: var(--accent); }

.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line);
  border-top-color: var(--accent); animation: spin 1s linear infinite; }
.spinner.small { display: inline-block; width: 16px; height: 16px; border-width: 3px; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

.item-id { font-size: 1.15rem; margin: 0 0 4px; }
.item-id strong { font-size: 1.3rem; }
.research { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; min-height: var(--touch); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.research form { margin-top: 8px; }
.group { margin: 0 0 8px; }
.group .grid { margin-top: 6px; }
.price-line .eur { font-size: 1.25rem; }
.mk-kleinanzeigen { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.mk-ebay { background: color-mix(in srgb, var(--info) 30%, transparent); }
.reason { color: var(--muted); }
.new .hint { grid-column: 1 / -1; margin: 0; font-size: .85rem; }

.filters { grid-column: 1 / -1; }
.conds { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.conds legend { font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; min-height: var(--touch);
  padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-weight: 500; }
.facts { font-size: .9rem; }
.text summary { min-height: 36px; font-size: .9rem; }
.listing-text { white-space: pre-line; font-size: .9rem; max-height: 50vh; overflow-y: auto; }
.details { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .9rem; margin: 4px 0; }
.details div { display: contents; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.snippet { font-size: .9rem; }

/* Photo strips (new-draft form and draft page): first tile = cover photo */
.strip { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.new .strip { grid-column: 1 / -1; }
.strip[hidden] { display: none; }
.tile { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column; }
.tile.cover { border: 2px solid var(--warn); }
.tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; }
.tile a { display: block; }
.cover-badge { position: absolute; top: 6px; right: 6px; background: var(--warn); color: #1c1300;
  font-weight: 700; font-size: .8rem; padding: 3px 8px; border-radius: 999px; pointer-events: none; }
.tile-btn { min-width: 44px; min-height: 44px; border: 0; border-radius: 10px; background: var(--card);
  color: var(--text); font-size: 1.2rem; cursor: pointer; }
.tile-btn:disabled { opacity: .3; cursor: default; }
.tile-btn.star { color: var(--warn); }
.tile-btn.danger { color: var(--error); }
.tile .handle { position: absolute; top: 6px; left: 6px; background: color-mix(in srgb, var(--bg) 75%, transparent);
  touch-action: none; cursor: grab; font-size: 1.4rem; }
.tile-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; padding: 4px; }
.tile.dragging { opacity: .85; z-index: 5; pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.tile.drop-target { outline: 3px dashed var(--accent); outline-offset: -3px; }
.photo-card h2 .muted { font-weight: 400; font-size: .9rem; }
.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
.lightbox::backdrop { background: rgba(0, 0, 0, .9); }
.lightbox img { display: block; max-width: 100vw; max-height: 100vh; object-fit: contain; }
.lightbox .close { position: fixed; top: max(8px, env(safe-area-inset-top)); right: 8px; background: var(--card); }
