:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1a1d21;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #11181c;
  --green: #1a7f37;
  --green-bg: #e7f4ec;
  --red: #b42318;
  --red-bg: #fdecea;
  --amber: #9a6700;
  --amber-bg: #fcf2d9;
  --blue: #0b6bcb;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; }
.small { font-size: 13px; }
.muted { color: var(--muted); }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 22px; height: 56px;
  background: var(--accent); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: #fff; text-decoration: none; letter-spacing: -.2px; }
.brand span { color: #8aa0ad; font-weight: 600; }
.brand-mark { height: 26px; width: auto; display: block; }
.tabs { display: flex; gap: 4px; margin-right: auto; }
.tabs a {
  color: #c7d0d6; text-decoration: none; padding: 8px 14px; border-radius: 7px;
  font-weight: 500; font-size: 14px;
}
.tabs a:hover { background: rgba(255,255,255,.08); color: #fff; }
.tabs a.active { background: #fff; color: var(--accent); }
.navpill { display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 6px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; vertical-align: 1px; }
.logout { color: #9fb0b9; text-decoration: none; font-size: 13px; }
.logout:hover { color: #fff; }

/* top progress bar for in-app (hx-boost) navigation — feedback without a full browser reload */
#nav-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999;
  pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .2s; }
html.navigating #nav-progress { opacity: 1; }
#nav-progress::before { content: ""; position: absolute; top: 0; height: 100%; width: 35%; left: -35%;
  background: var(--blue); border-radius: 0 3px 3px 0; }
html.navigating #nav-progress::before { animation: navslide .9s ease-in-out infinite; }
@keyframes navslide { 0% { left: -35%; } 60% { left: 70%; } 100% { left: 100%; } }

main { max-width: 1040px; margin: 0 auto; padding: 26px 22px 60px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.5px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.head-actions { display: flex; gap: 10px; }
.back { color: var(--muted); text-decoration: none; font-size: 13px; display: inline-block; margin-bottom: 4px; }
.back:hover { color: var(--ink); }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat .num { font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 7px; }
.stat.warn .num { color: var(--amber); }

/* search */
.search {
  width: 100%; padding: 11px 14px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  font-size: 15px;
}
.search:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

/* scan bar (Nr scannen → Gerät öffnen) */
.scanbar input { width: 100%; padding: 14px 16px; font-size: 16px; border: 2px solid var(--accent);
  border-radius: 11px; background: #fff; }
.scanbar input:focus { outline: 3px solid #cfe0fb; outline-offset: 0; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-size: 14px; resize: vertical; }
textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

/* printer rows (settings) */
.printer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.printer-row:last-of-type { border-bottom: none; margin-bottom: 6px; }
.pr-label { font-weight: 600; font-size: 14px; }
.printer-row select { max-width: 300px; }
.print-actions { display: flex; gap: 8px; align-items: center; }
.card .big { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.btn[disabled], button[disabled] { opacity: .5; pointer-events: none; }
.btn.arm, button.arm { background: var(--amber); color: #fff; border-color: var(--amber); }

/* sales pick (wizard) */
.step-chip { display: inline-block; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; padding: 3px 11px; border-radius: 999px; margin-bottom: 14px; }
.step-chip.done { background: var(--green); }
.pick-hint { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.pick-title { font-size: 32px; font-weight: 800; letter-spacing: -.6px; line-height: 1.1; }
.pick-sku { display: inline-block; margin-top: 14px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 18px; font-weight: 700; background: #eef1f3; color: var(--ink); padding: 7px 13px; border-radius: 9px; }
.pick-buyer { color: var(--muted); font-size: 14px; margin-top: 16px; }

/* tables */
.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.grid th, .grid td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.grid thead th { background: #fafbfc; color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr[onclick] { cursor: pointer; }
.grid tbody tr[onclick]:hover { background: #f7f9fb; }
.grid .r { text-align: right; }
.grid .count { font-weight: 700; font-size: 16px; }
.grid .empty { color: var(--muted); text-align: center; padding: 26px; }
.grid .link { color: var(--blue); text-decoration: none; font-weight: 500; }
.grid .link:hover { text-decoration: underline; }
/* sections / blocks */
.block { margin-bottom: 28px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.block-head h2 { margin: 0; font-size: 18px; }
.pill { display: inline-block; min-width: 18px; padding: 1px 8px; border-radius: 999px; background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 700; margin-left: 4px; vertical-align: 2px; }
.pill.amber { background: var(--amber); }

/* accordions (collapsible sections) */
.acc { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.acc > summary { list-style: none; cursor: pointer; padding: 15px 18px; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 8px; user-select: none; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::before { content: "▸"; color: var(--muted); font-size: 13px; transition: transform .15s; }
.acc[open] > summary::before { transform: rotate(90deg); }
.acc > summary:hover { background: #fafbfc; }
.acc-body { padding: 4px 18px 18px; }
.acc-body .grid { border: 1px solid var(--line); }
.acc-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.acc.todo { border-color: #e7d6a8; }
.acc.todo > summary { background: var(--amber-bg); color: #7a5200; }
.badge.blue { background: #e4eefb; color: var(--blue); }

/* lager overview (eine Tabelle + Filter + Sortierung) */
.lager-toolbar { display: flex; gap: 10px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.lager-toolbar .search { flex: 1; min-width: 220px; margin-bottom: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; border-left: 1px solid var(--line); background: transparent; padding: 9px 15px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: #f3f5f7; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button.on:hover { background: var(--accent); }
.seg button .c { font-weight: 700; opacity: .65; margin-left: 5px; }
.seg button.on .c { opacity: .8; }
.grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.grid th.sortable:hover { color: var(--ink); }
.grid th.sortable::after { content: "⇅"; font-size: 10px; margin-left: 5px; opacity: .35; }
.grid th.sortable.asc::after { content: "▲"; opacity: .85; }
.grid th.sortable.desc::after { content: "▼"; opacity: .85; }
.empty-note { color: var(--muted); text-align: center; padding: 26px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; margin-top: 14px; }

/* flow steps (preview pages) */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px;
  font-size: 13px; line-height: 1.4; }
.step-no { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; margin-bottom: 8px; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr 1fr; } }
.grid .nr { font-weight: 600; }
.badge.violet { background: #efe9fc; color: #6b3fd4; }
.stat.accent { border-color: #bcd3f5; background: #f4f8fe; }
.stat.accent .num { color: var(--blue); }
.card.placeholder { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.card.placeholder p { margin: 0; max-width: 60ch; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-left: 4px; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.gray { background: #eef1f3; color: var(--muted); }

/* buttons */
.btn {
  display: inline-block; padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f3f5f7; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #2a3138; }
.btn.danger { color: var(--red); border-color: #f1c9c4; background: #fff; }
.btn.danger:hover { background: var(--red-bg); }
.btn.small { padding: 6px 11px; font-size: 13px; }

/* async (HTMX) action button — spinner on the button itself while its request runs; the page never reloads */
form.htmx-request button[type=submit] { color: transparent !important; pointer-events: none; position: relative; }
form.htmx-request button[type=submit]::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -8px 0 0 -8px;
  border: 2px solid var(--ink); border-top-color: transparent; border-radius: 50%;
  animation: btnspin .6s linear infinite;
}
form.htmx-request button.primary[type=submit]::after { border-color: #fff; border-top-color: transparent; }
@keyframes btnspin { to { transform: rotate(360deg); } }

/* loading skeleton — placeholder that holds the layout so content doesn't pop in / jump */
.sk { display: inline-block; height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, #e9edf1 25%, #f3f6f8 50%, #e9edf1 75%); background-size: 200% 100%;
  animation: sksh 1.1s ease-in-out infinite; }
.sk-label { width: 150px; }
.sk-select { width: 280px; max-width: 300px; height: 38px; }
@keyframes sksh { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* optional, collapsed fields (e.g. capture form extras) */
.optfields { margin-top: 16px; border-top: 1px solid var(--line); }
.optfields > summary { cursor: pointer; list-style: none; color: var(--muted); font-weight: 600; font-size: 13px; padding: 12px 0 2px; }
.optfields > summary::-webkit-details-marker { display: none; }
.optfields > summary::before { content: "▸ "; font-size: 11px; }
.optfields[open] > summary::before { content: "▾ "; }

/* cards / forms */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 520px; }
.card h2 { margin: 0 0 14px; font-size: 16px; }
form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }
form label.check, form label.radio { color: var(--ink); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.radios { display: flex; gap: 18px; margin-top: 4px; }
input[type=text], input[type=password], input[type=search], select, input[type=file] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 15px; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
form .btn { margin-top: 16px; }
.radios .btn { margin-top: 0; }

.meta { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; display: grid; gap: 8px; }
.meta > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.meta span { color: var(--muted); }
.card form + form { margin-top: 8px; }

.hint { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.flash { padding: 11px 15px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash.ok { background: var(--green-bg); color: var(--green); }
.flash.warn { background: var(--amber-bg); color: var(--amber); }
.flash.err { background: var(--red-bg); color: var(--red); }

.urlbox { display: flex; align-items: center; gap: 10px; background: #fafbfc; border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; }
.urlbox code { flex: 1; word-break: break-all; font-size: 13px; }
.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.csv-box { margin-top: 18px; background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; padding: 18px; }

/* eBay */
.topnote { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 18px; background: var(--amber-bg); color: var(--amber); font-size: 14px; font-weight: 500;
  text-decoration: none; border-bottom: 1px solid #efe3bf; }
.topnote:hover { filter: brightness(.985); }
.topnote-cta { font-weight: 700; text-decoration: underline; }
.ebay-stat { display: flex; align-items: flex-start; gap: 12px; }
.ebay-stat .dot { width: 11px; height: 11px; border-radius: 50%; margin-top: 5px; flex: none;
  background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.ebay-stat.warn .dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.ebay-stat b { font-size: 15px; }
.connect-note { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--amber-bg); color: var(--amber); border: 1px solid #efe3bf; border-radius: 12px;
  padding: 13px 16px; margin-bottom: 18px; font-size: 14px; }
.ship-to { margin: 12px 0 0; padding: 12px 14px; background: #fafbfc; border: 1px solid var(--line);
  border-radius: 10px; font: 13px/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap; color: var(--ink); }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--accent); }
.login-card { background: var(--panel); border-radius: 16px; padding: 34px; width: 320px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-mark { width: 54px; height: 54px; display: block; margin: 2px auto -2px; }
.brand-big { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 6px; letter-spacing: -.5px; }
.brand-big span { color: #8aa0ad; }
.login-card .btn { margin-top: 4px; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .tabs a { padding: 8px 10px; }
  main { padding: 18px 14px 50px; }
}
