:root {
  --blue: #3665f3; --blue-d: #2a4fc4; --blue-l: #eef2ff;
  --ink: #191919; --ink-2: #4a4a4a; --ink-3: #767676;
  --line: #e5e5e5; --line-2: #d4d4d4; --bg: #f6f7f9; --card: #fff;
  --ok: #1d8a4e; --ok-l: #e7f6ee; --warn: #b26b00; --warn-l: #fff4e0; --err: #d0281f; --err-l: #fdecea;
  --r: 10px; --r-s: 7px;
  --sh: 0 1px 2px rgba(0,0,0,.05), 0 1px 1px rgba(0,0,0,.03);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
small, .muted { color: var(--ink-3); }
.hidden { display: none !important; }
code { background: #f1f1f1; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* Topbar */
.tenant { display: inline-flex; padding: 3px; border-radius: 10px; background: #f1f2f5; gap: 2px; margin-left: -12px; }
.tenant button { border: 0; background: none; font: inherit; font-weight: 700; font-size: 13px; letter-spacing: .03em; padding: 5px 14px; border-radius: 8px; color: var(--ink-3); cursor: pointer; }
.tenant button:hover { color: var(--ink); }
.tenant button.on { color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.tenant button.t0.on { background: #3665f3; } .tenant button.t1.on { background: #e8590c; } .tenant button.t2.on { background: #2b8a3e; } .tenant button.t3.on { background: #862e9c; }
body[data-tenant-idx="0"] .topbar { box-shadow: inset 0 -3px 0 #3665f3; } body[data-tenant-idx="1"] .topbar { box-shadow: inset 0 -3px 0 #e8590c; }
body[data-tenant-idx="2"] .topbar { box-shadow: inset 0 -3px 0 #2b8a3e; } body[data-tenant-idx="3"] .topbar { box-shadow: inset 0 -3px 0 #862e9c; }
.skuline { font-size: 13px; margin: -2px 0 12px; padding: 8px 10px; border-radius: var(--r-s); background: var(--bg); line-height: 1.5; word-break: break-all; }
.skuline code { font-size: 12px; }
.lp { display: inline-block; padding: 0 6px; border-radius: 4px; background: #eef0f4; color: #3c4560; font-weight: 700; font-size: 11.5px; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 28px; height: 56px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--blue); color: #fff; font-size: 13px; }
nav { display: flex; gap: 2px; }
nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
nav a:hover { background: var(--bg); text-decoration: none; }
nav a.active { color: var(--blue); background: var(--blue-l); }
.topright { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.pill.muted { cursor: default; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.pill.ok .dot { background: var(--ok); } .pill.warn .dot { background: #e5a000; } .pill.err .dot { background: var(--err); }
.pill.spin .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

main { padding: 20px; max-width: 1640px; margin: 0 auto; }

/* Controls */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 0 0 5px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 8px 10px; outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(54,101,243,.15); }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.row.tight > * { flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; }
.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input, .inline > select { flex: 1; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; line-height: 1.4; }
.counter { float: right; font-weight: 500; color: var(--ink-3); }
.counter.over { color: var(--err); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: #f4f4f4; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { color: var(--err); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 14px; }
.btn.icon { width: 30px; padding: 0; height: 30px; border-radius: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.loading { pointer-events: none; opacity: .7; }
.btn.loading::before { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; font-size: 13.5px; color: var(--ink); margin: 0; }
.switch input { display: none; }
.switch .tg { width: 36px; height: 20px; border-radius: 10px; background: #c8c8c8; position: relative; transition: background .15s; flex: 0 0 auto; }
.switch .tg::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .tg { background: var(--blue); }
.switch input:checked + .tg::after { left: 18px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-h h3 { flex: 1; }
.card-b { padding: 14px 16px; }
.section { background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.section > .sh { display: flex; align-items: center; gap: 8px; padding: 11px 14px; font-weight: 650; border-bottom: 1px solid var(--line); }
.section > .sh .sp { flex: 1; }
.section > .sb { padding: 12px 14px; }

.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; background: #efefef; color: var(--ink-2); white-space: nowrap; }
.chip.active { background: var(--ok-l); color: var(--ok); }
.chip.draft { background: #eef0f4; color: #55607a; }
.chip.ended { background: #f1f1f1; color: var(--ink-3); }
.chip.error { background: var(--err-l); color: var(--err); }
.chip.blue { background: var(--blue-l); color: var(--blue); }
.chip.warn { background: var(--warn-l); color: var(--warn); }

.alert { padding: 10px 12px; border-radius: var(--r-s); font-size: 13px; line-height: 1.45; margin-bottom: 10px; }
.alert.warn { background: var(--warn-l); color: #7a4a00; }
.alert.err { background: var(--err-l); color: #8e1b14; }
.alert.info { background: var(--blue-l); color: #233f9a; }
.alert.ok { background: var(--ok-l); color: #135e35; }

/* Listing */
.listing { display: grid; grid-template-columns: minmax(380px, 30%) 1fr; gap: 20px; align-items: start; }
.listing .left { padding-bottom: 80px; }
.listing .right { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; border-radius: var(--r); }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; gap: 10px; align-items: center; padding: 10px 20px; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(6px); }
.actionbar .sp { flex: 1; }
.qtybadge { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-s); background: var(--blue-l); color: #233f9a; font-size: 13px; }
.qtybadge b { font-size: 18px; color: var(--blue); }

/* Bilder */
.media { display: grid; grid-template-columns: 1.3fr 2fr; gap: 10px; }
.media .main { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--r-s); background: #fafafa center/contain no-repeat; display: grid; place-items: center; color: var(--ink-3); font-size: 12px; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; align-content: start; }
.thumb { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 6px; background: #fafafa center/contain no-repeat; cursor: grab; }
.thumb.drag { opacity: .4; }
.thumb.over, .media .main.over { outline: 2px solid var(--blue); }
.thumb .x, .media .main .x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; line-height: 20px; cursor: pointer; display: none; }
.thumb .star { position: absolute; bottom: 3px; left: 3px; height: 18px; padding: 0 6px; border-radius: 9px; border: 0; background: rgba(255,255,255,.92); font-size: 10.5px; cursor: pointer; display: none; }
.thumb:hover .x, .thumb:hover .star, .media .main:hover .x { display: block; }
.drop { display: grid; place-items: center; aspect-ratio: 1; border: 1.5px dashed var(--line-2); border-radius: 6px; color: var(--ink-3); font-size: 22px; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }

/* Merkmale */
.aspects .asp { display: grid; grid-template-columns: 38% 1fr; gap: 8px; align-items: center; margin-bottom: 6px; }
.aspects .asp label { margin: 0; font-weight: 500; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aspects .asp label .req { color: var(--err); }
.aspects .asp input, .aspects .asp select { padding: 6px 8px; font-size: 13px; }
.aspects .asp.missing input, .aspects .asp.missing select { border-color: #f0a29c; background: #fffafa; }
.aspects details summary { cursor: pointer; font-size: 12.5px; color: var(--blue); margin: 8px 0; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.tabs button { border: 0; background: none; padding: 8px 12px; font: inherit; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--blue); border-bottom-color: var(--blue); }
.rte { min-height: 160px; max-height: 420px; overflow: auto; border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 8px 12px; line-height: 1.5; outline: none; }
.rte:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(54,101,243,.15); }

/* eBay-Vorschau */
.pv { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pv-bar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #fafafa; font-size: 12.5px; color: var(--ink-3); }
.pv-bar .sp { flex: 1; }
.pv-in { padding: 18px 24px 4px; max-width: 1200px; }
.pv-crumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-3); margin-bottom: 16px; min-height: 16px; }
.pv-crumb span + span::before { content: "›"; margin-right: 6px; color: #b5b5b5; }
.pv-crumb span:last-child { color: var(--ink-2); }
.pv-top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.pv-gal { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: stretch; }
.pv-gal .ths { display: flex; flex-direction: column; gap: 8px; height: 0; min-height: 100%; overflow-y: auto; padding: 2px; scrollbar-width: thin; }
.pv-gal .ths div { width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 8px; background: #fff center/contain no-repeat; cursor: pointer; flex: 0 0 auto; }
.pv-gal .ths div:hover { border-color: #9a9a9a; }
.pv-gal .ths div.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.pv-gal .big { aspect-ratio: 1; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff center/contain no-repeat; background-origin: content-box; padding: 18px; display: grid; place-items: center; color: var(--ink-3); }
.pv-gal.single { grid-template-columns: minmax(0, 1fr); }
.pv-gal.single .ths { display: none; }
.pv-info { min-width: 0; }
.pv-title { font-size: 22px; font-weight: 700; line-height: 1.3; margin: 0 0 8px; overflow-wrap: anywhere; }
.pv-seller { font-size: 12.5px; color: var(--ink-3); padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.pv-price { font-size: 27px; font-weight: 700; line-height: 1.1; }
.pv-sub { font-size: 12.5px; color: var(--ink-3); margin: 4px 0 16px; }
.pv-kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 14px; font-size: 13.5px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.pv-kv > span:nth-child(odd) { color: var(--ink-3); }
.pv-buy { display: grid; gap: 10px; }
.pv-buy div { height: 44px; border-radius: 22px; display: grid; place-items: center; font-weight: 700; font-size: 14.5px; border: 1px solid var(--blue); color: var(--blue); }
.pv-buy div:first-child { background: var(--blue); color: #fff; }
.pv-h { font-size: 18px; font-weight: 700; margin: 30px 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.pv-asp { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; font-size: 13.5px; }
.pv-asp > div { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; align-items: baseline; }
.pv-asp > div span:first-child { color: var(--ink-3); }
.pv-asp > div span:last-child { overflow-wrap: anywhere; }
.pv-descwrap { padding-top: 0; padding-bottom: 26px; }
.pv-desc { display: block; width: 100%; border: 1px solid var(--line); border-radius: 8px; min-height: 200px; background: #fff; }
@media (max-width: 1350px) { .pv-top { grid-template-columns: minmax(0, 1fr); } .pv-asp { grid-template-columns: minmax(0, 1fr); } }

/* Bestand */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { width: 280px; flex: 0 0 auto; }
.toolbar select { width: 170px; flex: 0 0 auto; }
.toolbar .sp { flex: 1; }
table.t { width: 100%; border-collapse: collapse; background: #fff; }
table.t th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 10px; border-bottom: 1px solid var(--line); background: #fafafa; position: sticky; top: 56px; z-index: 2; }
table.t td { padding: 9px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
table.t tr:hover td { background: #fbfcff; }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow: clip; }
.modal-box table.t th { top: 0; }
.timg { width: 44px; height: 44px; border-radius: 6px; border: 1px solid var(--line); background: #fafafa center/contain no-repeat; }
.ttl { font-weight: 600; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { font-size: 12px; color: var(--ink-3); }
.stockedit { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; height: 30px; }
.stockedit button { width: 28px; height: 100%; border: 0; background: #f6f6f6; cursor: pointer; font-size: 15px; color: var(--ink-2); }
.stockedit button:hover { background: #ececec; }
.stockedit input { width: 54px; border: 0; border-radius: 0; text-align: center; padding: 0; height: 100%; font-weight: 650; box-shadow: none !important; }
.ebayqty { font-weight: 700; font-size: 15px; }
.ebayqty .arrow { color: var(--warn); font-size: 12px; font-weight: 600; }
.rulesel { width: 195px; padding: 5px 8px; font-size: 12.5px; }
.err-line { color: var(--err); font-size: 11.5px; max-width: 280px; margin-top: 3px; }
.empty { padding: 50px; text-align: center; color: var(--ink-3); }

/* Regeln */
.rules { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.plist { display: grid; gap: 8px; }
.pitem { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; }
.pitem:hover { border-color: var(--line-2); }
.pitem.on { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(54,101,243,.12); }
.pitem .n { font-weight: 650; display: flex; gap: 8px; align-items: center; }
.ruletable { width: 100%; border-collapse: collapse; margin-top: 8px; }
.ruletable td, .ruletable th { padding: 6px 10px; border-bottom: 1px solid #f0f0f0; text-align: right; font-variant-numeric: tabular-nums; }
.ruletable th { font-size: 12px; color: var(--ink-3); }
.ruletable td:first-child, .ruletable th:first-child { text-align: left; }
.bar { display: inline-block; height: 8px; border-radius: 4px; background: var(--blue); vertical-align: middle; }
.bigcalc { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r); background: var(--blue-l); margin-bottom: 14px; }
.bigcalc input { width: 90px; font-size: 18px; font-weight: 700; text-align: center; }
.bigcalc .res { font-size: 28px; font-weight: 800; color: var(--blue); }
.steps { font-size: 12.5px; color: #233f9a; }

/* Einstellungen */
.settings { display: grid; grid-template-columns: 210px 1fr; gap: 24px; align-items: start; }
.snav { position: sticky; top: 76px; display: grid; gap: 2px; }
.snav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.snav a:hover { background: #fff; text-decoration: none; }
.settings .card { margin-bottom: 16px; scroll-margin-top: 76px; }
.secret-state { font-size: 12px; margin-left: 6px; font-weight: 500; }
.secret-state.on { color: var(--ok); } .secret-state.off { color: var(--ink-3); }
.status-line { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-s); background: var(--bg); margin-bottom: 12px; }
ol.steps-list { padding-left: 18px; margin: 6px 0; line-height: 1.6; color: var(--ink-2); font-size: 13px; }

/* Toast + Modal */
#toasts { position: fixed; right: 20px; bottom: 70px; z-index: 100; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 460px; padding: 11px 14px; border-radius: 10px; background: #222; color: #fff; font-size: 13px; line-height: 1.4; box-shadow: 0 6px 22px rgba(0,0,0,.2); animation: tin .2s; }
.toast.err { background: #b3261e; } .toast.ok { background: #1d6b40; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.35); display: grid; place-items: center; padding: 20px; }
.modal-box { background: #fff; border-radius: 14px; width: min(640px, 100%); max-height: 86vh; overflow: auto; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-box h3 { margin-bottom: 12px; font-size: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

@media (max-width: 1100px) {
  .listing, .rules, .settings { grid-template-columns: 1fr; }
  .listing .right { position: static; max-height: none; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .snav { display: none; }
}

/* Benutzermenü */
.um { position: relative; }
.um-pop { position: absolute; right: 0; top: 38px; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px 0; z-index: 50; }
.um-pop a { display: block; padding: 8px 12px; color: var(--ink); font-size: 13.5px; }
.um-pop a:hover { background: var(--bg); text-decoration: none; }
