:root {
  --bg: #f3f3f1; --card: #fff; --ink: #1b1b1b; --muted: #6b6b6b; --line: #e4e1db;
  --gold: #c9a063; --gold-dark: #b48a4c; --gold-soft: #f3e9d8; --side: #1f1f1f; --side-ink: #eee;
  --ok: #2e7d32; --warn: #b26a00; --bad: #c62828; --info: #1565c0;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 "Segoe UI", "Open Sans", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
a { color: var(--info); }
h1, h2, h3 { margin: 0 0 8px; font-weight: 600; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }

/* ---------- Layout */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; letter-spacing: .28em; font-size: 12px; font-weight: 600; }
.brand.big { justify-content: center; margin-bottom: 14px; color: var(--ink); }
.brand-mark { width: 26px; height: 26px; border: 3px solid var(--gold); border-radius: 50%; position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--gold); }
.sidebar-title { font-size: 17px; font-weight: 600; padding-bottom: 12px; border-bottom: 1px solid #333; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { color: var(--side-ink); text-decoration: none; padding: 11px 16px; border-radius: 24px; background: #2a2a2a; transition: background .15s; }
.nav a:hover { background: #343434; }
.nav a.active { background: var(--gold); color: #1b1b1b; font-weight: 600; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sidebar-foot .link { color: var(--gold); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font: inherit; }
.main { padding: 22px 28px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); border-bottom: 3px solid var(--gold); display: inline-block; padding-bottom: 3px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Karten, Knöpfe, Formulare */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card.accent { border-left: 4px solid var(--gold); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.btn { border: 0; border-radius: 22px; padding: 10px 20px; font: inherit; font-weight: 600; cursor: pointer; background: #e9e6df; color: var(--ink); transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(.96); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold { background: var(--gold); }
.btn.dark { background: var(--side); color: #fff; }
.btn.danger { background: #fde8e8; color: var(--bad); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 6px 14px; font-size: 13px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #333; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfcac2; border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
textarea { min-height: 90px; resize: vertical; }
.check { flex-direction: row; align-items: center; gap: 8px; padding-top: 22px; }
.check input { width: 18px; height: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span4 { grid-column: span 4; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0 0 14px; }
legend { padding: 0 8px; font-weight: 600; color: var(--gold-dark); }
.feld.unsicher input, .feld.unsicher select { border-color: var(--warn); background: #fff8ec; }
.feld-leer input, .feld-leer select { background: #fafafa; }
.feld .tag { font-size: 11px; color: var(--warn); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; background: #eee; }
.chip.gold { background: var(--gold-soft); color: var(--gold-dark); }
.chip.ok { background: #e6f3e7; color: var(--ok); }
.chip.warn { background: #fff3e0; color: var(--warn); }
.chip.bad { background: #fde8e8; color: var(--bad); }
.chip.info { background: #e3eefb; color: var(--info); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.space { justify-content: space-between; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar label { min-width: 120px; }
.toolbar .search { flex: 1 1 260px; }

/* ---------- KPIs */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.kpi .big { font-size: 32px; font-weight: 300; }
.kpi .zeile { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); }
.kpi .zeile b { color: var(--gold-dark); }
.kpi .titel { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #444; }

/* ---------- Dropzone */
.dropzone { border: 2px dashed #cdbfa2; border-radius: var(--radius); background: #fcfaf6; padding: 34px 20px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone.over { background: var(--gold-soft); border-color: var(--gold); }
.dropzone .ico { font-size: 42px; line-height: 1; margin-bottom: 8px; }
.dropzone b { display: block; font-size: 17px; }
.dropzone input { display: none; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.thumb { position: relative; border-radius: 8px; overflow: hidden; background: #ddd; aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb .nr { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 1px 7px; border-radius: 10px; }
.thumb .art { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(27,27,27,.78); color: #fff; font-size: 11px; padding: 4px 6px; }
.thumb .x { position: absolute; right: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; line-height: 1; }
.fototipps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 14px; }
.fototipps div { background: #f7f5f0; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.fototipps b { display: block; color: var(--gold-dark); }
.progress { margin-top: 16px; padding: 18px; border-radius: var(--radius); background: var(--gold-soft); display: flex; align-items: center; gap: 14px; }
.spinner { width: 26px; height: 26px; border: 3px solid #e0cfae; border-top-color: var(--gold-dark); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; background: #e8dcc5; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--gold-dark); width: 0; transition: width .3s; }

/* ---------- Prüfansicht */
.review { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.review .thumbs { grid-template-columns: repeat(2, 1fr); margin-top: 0; }
.hinweisbox { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.hinweisbox.warn { background: #fff3e0; border-left: 4px solid var(--warn); }
.hinweisbox.bad { background: #fde8e8; border-left: 4px solid var(--bad); }
.hinweisbox.info { background: #e3eefb; border-left: 4px solid var(--info); }
.hinweisbox ul { margin: 4px 0 0; padding-left: 18px; }
.typwahl { display: flex; gap: 8px; flex-wrap: wrap; }
.typwahl label { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; cursor: pointer; }
.typwahl input { width: auto; }
.typwahl label:has(input:checked) { background: var(--gold-soft); border-color: var(--gold); }
.note { display: inline-flex; gap: 3px; }
.note span { width: 14px; height: 14px; border-radius: 50%; background: #e0e0e0; }
.note.n1 span:nth-child(-n+1), .note.n2 span:nth-child(-n+2), .note.n3 span:nth-child(-n+3), .note.n4 span:nth-child(-n+4), .note.n5 span { background: var(--gold); }
.note.n4 span, .note.n5 span { background: var(--bad); }

/* ---------- Listen */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.satz { display: grid; grid-template-columns: 1fr auto; gap: 8px; background: #f8f7f4; border-radius: var(--radius); padding: 12px 14px; cursor: pointer; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.satz:hover { border-color: var(--gold); background: #fff; }
.satz .titel { font-weight: 600; }
.satz .zeile { font-size: 13.5px; color: #333; }
.satz .zeile span { color: var(--muted); }
.satz .rechts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12px; color: var(--muted); }
.satz .preis { color: var(--gold-dark); font-weight: 600; margin-top: 4px; }
.satz img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.pos { background: var(--gold-soft); color: var(--gold-dark); padding: 2px 10px; border-radius: 6px; font-weight: 600; font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tr.klick { cursor: pointer; } tr.klick:hover td { background: #faf8f3; }

/* ---------- Lagerplan */
.regale { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.regal table { table-layout: fixed; }
.regal td { padding: 3px; border: 0; }
.platz { display: block; border-radius: 6px; padding: 5px 4px; font-size: 11px; text-align: center; background: #eceae5; color: #777; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.platz.belegt { background: var(--gold); color: #1b1b1b; font-weight: 600; }
.platz.belegt.felgen { background: #8d8d8d; color: #fff; }
.platz.belegt.komplett { background: linear-gradient(135deg, var(--gold) 50%, #8d8d8d 50%); color: #1b1b1b; }
.legende { display: flex; gap: 14px; font-size: 13px; align-items: center; flex-wrap: wrap; }
.legende i { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: middle; margin-right: 4px; }

/* ---------- Detail */
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

/* ---------- Login, Toast, Lightbox */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #2b2b2b, #141414); padding: 20px; }
.login-card { background: #fff; border-radius: 14px; padding: 34px 32px; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-card h1 { text-align: center; }
.login-card p { text-align: center; margin: -8px 0 6px; }
.login-fehler { color: var(--bad); font-size: 14px; min-height: 18px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--side); color: #fff; padding: 12px 20px; border-radius: 24px; box-shadow: 0 8px 30px rgba(0,0,0,.3); z-index: 50; max-width: 90vw; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: grid; place-items: center; z-index: 60; }
.lightbox img { max-width: 95vw; max-height: 92vh; object-fit: contain; }
.lb-close { position: absolute; top: 14px; right: 18px; font-size: 34px; background: none; border: 0; color: #fff; cursor: pointer; }
.leer { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 1000px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span4 { grid-column: span 2; }
  .review { grid-template-columns: 1fr; }
  .review .thumbs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px 14px; gap: 8px; }
  .sidebar-title, .sidebar-foot .small { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { padding: 8px 12px; font-size: 14px; }
  .sidebar-foot { flex-direction: row; gap: 12px; margin: 0; }
  .main { padding: 14px 16px 50px; }
  .kpis, .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2, .form-grid .span4 { grid-column: span 1; }
  .dropzone { padding: 24px 12px; }
}
