* { box-sizing: border-box; }
body { font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: #f4f5f7; margin: 0; color: #1f2937; }
header { background: #1f2937; color: white; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
header a { color: white; text-decoration: none; margin-right: 16px; font-weight: 500; }
header a:hover { text-decoration: underline; }
header nav, header .user { display: flex; align-items: center; flex-wrap: wrap; }
header .user form { display: inline; }
.linkbtn { background: none; border: none; color: white; padding: 0; margin: 0; font: inherit; font-weight: 500; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; background: none; }
.brand { font-size: 1.2rem; font-weight: 700; }
.container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.card { background: white; border-radius: 10px; padding: 20px 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e5e7eb; font-size: 0.92rem; vertical-align: top; }
th { background: #f9fafb; font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:hover { background: #fafafa; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.95rem; margin-top: 4px; font-family: inherit; }
input[type=checkbox] { width: auto; margin: 0 8px 0 0; }
label { font-weight: 600; font-size: 0.88rem; color: #374151; display: block; margin-top: 12px; }
label.check { font-weight: 400; display: flex; align-items: center; margin-top: 6px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 200px; }
button, .btn { background: #2563eb; color: white; border: none; padding: 10px 18px; border-radius: 6px; font-size: 0.95rem; cursor: pointer; text-decoration: none; display: inline-block; margin-top: 14px; margin-right: 8px; }
button:hover, .btn:hover { background: #1d4ed8; }
.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #4b5563; }
.btn-success { background: #16a34a; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-small { padding: 5px 10px; font-size: 0.85rem; margin: 0 4px 0 0; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-offen { background: #fef3c7; color: #92400e; }
.badge-in_bearbeitung { background: #dbeafe; color: #1e40af; }
.badge-erledigt { background: #dcfce7; color: #166534; }
.badge-storniert { background: #fee2e2; color: #991b1b; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 0.9rem; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-warn { background: #fef3c7; color: #92400e; }
.filters { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.filters a { font-size: 0.88rem; color: #2563eb; text-decoration: none; }
.filters a.active { font-weight: 700; text-decoration: underline; }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input { margin: 0; max-width: 360px; }
.search button { margin: 0; }
.pagination { margin-top: 14px; font-size: 0.9rem; display: flex; gap: 12px; align-items: center; }
.muted { color: #6b7280; font-size: 0.85rem; }
.inline { display: inline; }
.inline input { width: auto; display: inline-block; margin: 0 4px 0 0; }
.inline select { width: auto; display: inline-block; margin: 0 4px 0 0; }
.inline button { margin: 0; }
.cancelled { text-decoration: line-through; color: #6b7280; }
h2 { margin-top: 0; }
h3 { margin-bottom: 6px; }
.losinfo { margin-top: 6px; min-height: 1.2em; font-weight: 600; color: #1f2937; }

/* ---- Touch / iPad ---------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; padding-bottom: env(safe-area-inset-bottom); }
button, .btn, a, summary, select, label.check { touch-action: manipulation; }
header { padding: max(14px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 14px max(24px, env(safe-area-inset-left)); }
header nav a, header .user a, .linkbtn { padding: 10px 6px; display: inline-block; font-size: 1rem; }
input, select, textarea { font-size: 1rem; min-height: 46px; } /* >=16px: kein Auto-Zoom in Safari */
textarea { min-height: 70px; }
input[type=checkbox] { width: 24px; height: 24px; min-height: 0; }
label.check { min-height: 40px; }
button, .btn { min-height: 46px; font-size: 1rem; padding: 11px 20px; }
.btn-small { min-height: 40px; padding: 8px 14px; font-size: 0.95rem; }
.btn-big { min-height: 60px; font-size: 1.25rem; font-weight: 700; width: 100%; margin: 0; }
th, td { font-size: 1rem; padding: 12px 8px; }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tablewrap table { min-width: 560px; }
.container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

/* Erfassung */
.lotcard { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 12px 16px 14px; margin-bottom: 8px; }
.lotnav { display: flex; gap: 10px; align-items: stretch; }
.lotnav input { text-align: center; font-size: 1.8rem; font-weight: 700; min-height: 60px; margin-top: 4px; flex: 1; }
.lotstep { margin: 4px 0 0; min-width: 70px; font-size: 1.4rem; }
.losinfo { min-height: 2.6em; margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.losinfo .lt { font-size: 1.25rem; font-weight: 700; color: #111827; }
.losinfo .ls { font-size: 1rem; color: #374151; font-weight: 600; }
.losinfo.warn { color: #b45309; font-size: 1rem; }
.bigbid { font-size: 1.8rem; font-weight: 700; min-height: 60px; text-align: right; }
.quickbids { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.quickbids button { margin: 0; flex: 1; min-width: 70px; }
.more { margin-top: 14px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 0 14px 12px; }
.more summary { cursor: pointer; font-weight: 600; padding: 14px 0; min-height: 46px; color: #374151; }
.actionbar { position: sticky; bottom: 0; background: linear-gradient(to top, #fff 75%, rgba(255,255,255,0)); padding: 14px 0 max(8px, env(safe-area-inset-bottom)); margin-top: 10px; z-index: 5; }

@media (max-width: 820px) {
  header { padding-left: 14px; padding-right: 14px; }
  .brand { font-size: 1.05rem; }
  .card { padding: 16px; }
  .row > div { min-width: 100%; }
  .container { margin: 14px auto; }
}
.quickbids button { padding-left: 8px; padding-right: 8px; white-space: nowrap; }
header a { margin-right: 10px; }
.brand { margin-right: 12px; }

/* Live-Hinweis neue Vorgänge */
.navbadge { background: #ef4444; color: #fff; border-radius: 12px; padding: 1px 8px; margin-left: 6px; font-size: 0.8rem; font-weight: 700; }
.navbadge[hidden] { display: none; }
.toasts { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 24px)); z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #16a34a; color: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.3); display: flex; gap: 12px; align-items: center; animation: toastin .25s ease-out; }
.toast .tt { flex: 1; line-height: 1.35; }
.toast .tt b { font-size: 1.05rem; display: block; }
.toast a, .toast button { background: #fff; color: #166534; font-weight: 700; margin: 0; border-radius: 8px; padding: 10px 14px; min-height: 44px; text-decoration: none; }
.toast button.x { background: transparent; color: #fff; padding: 10px; font-size: 1.2rem; }
@keyframes toastin { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Katalogfotos */
.lotbody { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.lotmain { flex: 1 1 320px; min-width: 0; }
.lotpic { flex: 0 0 auto; width: min(300px, 100%); background: #fff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 6px; margin: 0; min-height: 0; cursor: zoom-in; }
.lotpic:hover { background: #fff; }
.lotpic[hidden] { display: none; }
.lotpic img { display: block; width: 100%; max-height: 300px; object-fit: contain; border-radius: 6px; }
.losinfo .ld { font-size: 0.95rem; color: #4b5563; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; display: block; background: #f3f4f6; }
.thumblink { display: inline-block; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.overlay[hidden] { display: none; }
.overlay img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; }
.overlay-x { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 18px; color: #fff; font-size: 2rem; }
@media (max-width: 820px) { .lotpic { width: 100%; } .lotpic img { max-height: 260px; } }

/* Abschluss-Maske: Stornieren links, Abschließen rechts (CSP erlaubt keine Inline-Styles) */
.btnsplit { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
fieldset.plain { border: none; padding: 0; margin: 0; min-width: 0; }
.nogebot { margin-top: 10px; }
.warnbox { margin-top: 16px; }

/* Ersatz für Inline-Styles (die Sicherheitsrichtlinie CSP erlaubt keine) */
.w170 { width: 170px; }
.cardw480 { max-width: 480px; }
.f140 { flex: 0 0 140px; min-width: 120px; }
.mlauto { margin-left: auto; }
.cardlogin { max-width: 400px; margin: 40px auto; }
.m0 { margin: 0; }
.small { font-size: .85rem; }
.w160 { width: 160px; }
.mt14 { margin-top: 14px; }
.cardw640 { max-width: 640px; }
.mt4 { margin-top: 4px; }
.f170 { flex: 0 0 170px; min-width: 130px; }
.flex2 { flex: 2; }
.flex2w { flex: 2; min-width: 300px; }
.foot { text-align: center; margin: 24px 0; }
input[readonly] { background: #f1f5f9; color: #475569; cursor: not-allowed; }
