/* D.'s Nutz Lager — ruhige Arbeitsoberfläche für PC und Handy im Lager.
   Ein auffälliges Element: das Set-Kästchen (.code), wie unten auf der Karte gedruckt. */

@font-face { font-family: "Atkinson"; src: url("../fonts/AtkinsonHyperlegible-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("../fonts/AtkinsonHyperlegible-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #eceff2;
  --surface: #ffffff;
  --ink: #1c232b;
  --muted: #5d6873;
  --line: #d3d9df;
  --accent: #245789;
  --accent-ink: #ffffff;
  --marker: #f2c230;
  --code-bg: #20272e;
  --danger: #a3312b;
  --ok: #2e6b3f;
  --radius-s: 4px;
  --radius-m: 8px;
  --space: 16px;
  --font: "Atkinson", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--font);
}
a { color: var(--accent); text-underline-offset: 2px; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; max-width: 68ch; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- Rahmen ------------------------------------------------------------- */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner { max-width: 1160px; margin: 0 auto; padding: 0 var(--space); display: flex; align-items: center; gap: 24px; height: 56px; }
.wordmark { font-weight: 700; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.wordmark .code { font-size: .8rem; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: 16px 10px; border-bottom: 3px solid transparent; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--marker); font-weight: 700; }
.nav a:hover { color: var(--ink); }
.topbar form { margin: 0; }

main { max-width: 1160px; margin: 0 auto; padding: 24px var(--space) 96px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin: 0; }

/* Handy: Navigation unten, mit dem Daumen erreichbar */
.tabbar { display: none; }
@media (max-width: 720px) {
  .nav, .topbar .logout { display: none; }
  .topbar-inner { height: 48px; }
  h1 { font-size: 1.4rem; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; inset: auto 0 0 0; z-index: 10;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { text-align: center; padding: 10px 4px 12px; color: var(--muted); text-decoration: none; font-size: .85rem; border-top: 3px solid transparent; }
  .tabbar a[aria-current="page"] { color: var(--ink); border-top-color: var(--marker); font-weight: 700; }
}

/* --- Das Set-Kästchen ---------------------------------------------------- */
.code {
  display: inline-flex; align-items: baseline; gap: 3px;
  background: var(--code-bg); color: #fff; border-radius: var(--radius-s);
  padding: 1px 6px 2px; font-weight: 700; font-size: .78rem; letter-spacing: .03em;
  line-height: 1.4; white-space: nowrap; vertical-align: 1px;
}
.code .lang { font-size: .62rem; opacity: .75; font-weight: 400; }
.num { font-weight: 700; font-style: italic; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num .total { color: var(--muted); font-weight: 400; }

/* --- Bausteine ----------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.flash { background: #e7f1ea; border: 1px solid #b9d6c1; color: var(--ok); padding: 10px 14px; border-radius: var(--radius-m); margin-bottom: 16px; }
.error { background: #f8e9e8; border: 1px solid #e3bcb9; color: var(--danger); padding: 10px 14px; border-radius: var(--radius-m); margin-bottom: 16px; }

label { display: block; font-weight: 700; margin: 0 0 6px; }
input[type=text], input[type=password], input[type=search], input[inputmode=numeric] {
  width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid #b9c1c9; border-radius: var(--radius-s); padding: 11px 12px; min-height: 46px;
}
input:focus { border-color: var(--accent); }
.field { margin-bottom: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  font: inherit; font-weight: 700; border-radius: var(--radius-s); padding: 10px 18px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 400; }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: .875rem; }
.btn.block { width: 100%; }

/* --- Anmeldung ----------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--space); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box .wordmark { margin-bottom: 24px; font-size: 1.15rem; }
.auth-box h1 { font-size: 1.4rem; }
.code-input { font-size: 1.6rem !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { background: #fff; padding: 12px; display: inline-block; border: 1px solid var(--line); border-radius: var(--radius-m); }
.secret { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .95rem; word-break: break-all; background: var(--paper); padding: 8px 10px; border-radius: var(--radius-s); }
ol.steps { padding-left: 1.2em; } ol.steps li { margin-bottom: 8px; }

/* --- Übersicht ----------------------------------------------------------- */
.figures { display: flex; flex-wrap: wrap; gap: 32px; margin: 0 0 28px; }
.figure strong { display: block; font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figure span { color: var(--muted); font-size: .9rem; }
.roadmap { list-style: none; margin: 0; padding: 0; }
.roadmap li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.roadmap li:first-child { border-top: 0; }
.roadmap .mark { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); margin-top: 3px; }
.roadmap .done .mark { background: var(--ok); border-color: var(--ok); }
.roadmap .now .mark { border-color: var(--marker); background: var(--marker); }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* --- Katalog ------------------------------------------------------------- */
.searchbar { position: relative; max-width: 560px; flex: 1 1 320px; }
.searchbar input { padding-left: 14px; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 10px; }

.series { margin-bottom: 28px; }
.series > h2 { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 4px; }
.setlist { list-style: none; margin: 0; padding: 0; }
.setlist a {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 10px 6px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line);
}
.setlist a:hover { background: var(--surface); }
.setlist .logo { width: 64px; height: 32px; object-fit: contain; }
.setlist .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setlist .meta { color: var(--muted); font-size: .85rem; }
.setlist .count { color: var(--muted); font-size: .85rem; text-align: right; white-space: nowrap; }

.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
@media (max-width: 480px) { .cardgrid { grid-template-columns: repeat(2, 1fr); gap: 14px 10px; } }
.tile { color: var(--ink); text-decoration: none; display: block; }
.tile .img { aspect-ratio: 63 / 88; background: #dfe3e7; border-radius: 6px; overflow: hidden; display: grid; place-items: center; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .img .missing { color: var(--muted); font-size: .8rem; text-align: center; padding: 8px; }
.tile .label { margin-top: 6px; font-size: .9rem; line-height: 1.3; }
.tile .label .name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile:hover .name { text-decoration: underline; }

.results-head { color: var(--muted); margin: 0 0 14px; }

.carddetail { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 32px; align-items: start; }
@media (max-width: 720px) { .carddetail { grid-template-columns: 1fr; } .carddetail .big { max-width: 300px; } }
.carddetail .big { aspect-ratio: 63 / 88; border-radius: 12px; overflow: hidden; background: #dfe3e7; display: grid; place-items: center; }
.carddetail .big .missing { color: var(--muted); }
.carddetail .big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 24px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.variants { list-style: none; padding: 0; margin: 0 0 24px; border-top: 1px solid var(--line); }
.variants li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pager { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.empty { padding: 32px 0; color: var(--muted); }

/* --- Formularelemente ---------------------------------------------------- */
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
select { font: inherit; color: inherit; background: var(--surface); border: 1px solid #b9c1c9; border-radius: var(--radius-s); padding: 10px 12px; min-height: 46px; width: 100%; }
.narrow { max-width: 560px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions form { margin: 0; }
.segmented { display: inline-flex; border: 1px solid #b9c1c9; border-radius: var(--radius-s); overflow: hidden; background: var(--surface); }
.segmented.wrap { display: flex; flex-wrap: wrap; border: 0; gap: 8px; background: none; overflow: visible; }
.segmented label { margin: 0; font-weight: 400; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: block; padding: 10px 14px; min-height: 44px; border-left: 1px solid #d3d9df; }
.segmented label:first-child span { border-left: 0; }
.segmented.wrap span { border: 1px solid #b9c1c9; border-radius: var(--radius-s); }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 700; border-color: var(--accent); }
.segmented input:focus-visible + span { outline: 3px solid var(--marker); outline-offset: -3px; }
.row2 { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: end; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
kbd { font: inherit; font-size: .75rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; color: var(--muted); background: var(--surface); }
@media (hover: none) { kbd { display: none; } }

/* --- Batches ------------------------------------------------------------- */
.bnum { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
h1 .bnum { margin-right: 6px; }
.batchlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.batchlist a { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 6px;
  border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.batchlist a:hover { background: var(--surface); }
.bstats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; font-size: .9rem; }
.pill { border-radius: 999px; padding: 1px 10px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.pill.todo { background: var(--marker); color: var(--ink); }
.pill.run { background: #dce6f0; color: var(--accent); }
.pill.ok { background: #e1efe5; color: var(--ok); }
.empty-panel { max-width: 560px; }

.upload { margin-bottom: 20px; padding: 0; overflow: hidden; }
.dropzone { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; text-align: center;
  min-height: 120px; padding: 20px; margin: 0; border: 2px dashed #b9c1c9; border-radius: var(--radius-m); cursor: pointer; font-weight: 400; }
.dropzone strong { font-size: 1.05rem; }
.dropzone.over { border-color: var(--accent); background: #eef3f8; }
.progress { position: relative; height: 34px; background: var(--paper); border-top: 1px solid var(--line); }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: #d4e2ef; transition: width .2s; }
.progress .ptext { position: relative; display: block; padding: 6px 14px; font-size: .9rem; }
.upload.failed .progress .bar { background: #f3d6d4; }

.batchbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 8px; }
.figures.compact { gap: 24px; margin: 0; }
.figures.compact .figure strong { font-size: 1.5rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 12px 0 18px; overflow-x: auto; }
.tabs a { padding: 10px 12px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--marker); }

.scangrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
@media (max-width: 480px) { .scangrid { grid-template-columns: repeat(2, 1fr); gap: 14px 10px; } }
.scan { color: var(--ink); text-decoration: none; display: block; }
.scan .img { position: relative; aspect-ratio: 63 / 88; background: #dfe3e7; border-radius: 6px; overflow: hidden; display: grid; place-items: center;
  outline: 3px solid transparent; outline-offset: -3px; }
.scan img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan .img .missing { color: var(--muted); font-size: .85rem; }
.posnum { position: absolute; top: 6px; left: 6px; background: rgba(255,255,255,.9); color: var(--ink); font-size: .75rem; font-weight: 700;
  border-radius: 3px; padding: 0 5px; font-variant-numeric: tabular-nums; }
.scan .label { margin-top: 6px; font-size: .9rem; line-height: 1.35; }
.scan .label .name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan .var { display: block; color: var(--muted); font-size: .8rem; }
.scan .state { display: block; font-size: .8rem; color: var(--muted); }
.scan.s-review .img, .scan.s-error .img { outline-color: var(--marker); }
.scan.s-review .state, .scan.s-error .state { color: #8a6a00; font-weight: 700; }
.scan.s-confirmed .state { color: var(--ok); }
.scan:hover .name { text-decoration: underline; }

/* --- Prüfen -------------------------------------------------------------- */
.review { display: grid; grid-template-columns: minmax(300px, 520px) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .review { grid-template-columns: 1fr; } }
.compare { margin: 0; position: sticky; top: 72px; }
@media (max-width: 900px) { .compare { position: static; } }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair .big { aspect-ratio: 63 / 88; border-radius: 10px; overflow: hidden; background: #dfe3e7; display: grid; place-items: center; }
.pair .big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pair .big .missing { color: var(--muted); font-size: .9rem; text-align: center; padding: 8px; }
.pair figcaption { color: var(--muted); font-size: .85rem; margin-top: 6px; text-align: center; }
.decide { display: grid; gap: 20px; }
.choices { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.choice { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); color: var(--ink); text-decoration: none; line-height: 1.35; }
.choice:hover { border-color: #9fb0c1; }
.choice.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice .thumb, .chosen-head .thumb { width: 52px; aspect-ratio: 63 / 88; border-radius: 4px; overflow: hidden; background: #dfe3e7; display: grid; place-items: center; }
.choice .thumb img, .chosen-head .thumb img { width: 100%; height: 100%; object-fit: cover; }
.choice .thumb .missing, .chosen-head .thumb .missing { font-size: .6rem; color: var(--muted); text-align: center; }
.fit { color: var(--muted); font-size: .82rem; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.choice-panel h2 { margin-bottom: 2px; }
.chosen-head { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: start; margin-bottom: 16px; }
.chosen-head p { margin: 0; }
.danger-zone { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.danger-zone details { flex-basis: 100%; }
.danger-zone pre { white-space: pre-wrap; font-size: .8rem; background: var(--surface); padding: 10px; border-radius: var(--radius-s); border: 1px solid var(--line); }

/* --- Lupe ---------------------------------------------------------------- */
img[data-loupe] { cursor: zoom-in; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.loupe { position: fixed; z-index: 60; width: 260px; height: 260px; border-radius: 50%; pointer-events: none;
  border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgba(20, 28, 36, .35);
  background-color: #fff; background-repeat: no-repeat; display: none; }
.loupe .zoom { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); background: rgba(28,35,43,.75);
  color: #fff; font-size: .75rem; border-radius: 999px; padding: 1px 8px; }
.loupe-hint { display: block; font-size: .78rem; }
@media (max-width: 720px) { .loupe { width: 200px; height: 200px; } }
.btn.danger { color: var(--danger); border-color: #e3bcb9; }
