:root {
  --bg: #0f1020; --panel: #181a2e; --panel2: #20233b; --line: #2c3050;
  --text: #ecebf5; --muted: #9a9cbc; --accent: #ff8a3d; --accent2: #ffb27d;
  --ok: #3ccf8e; --warn: #ffcc4d; --err: #ff5d6c; --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 Inter, system-ui, sans-serif; }
a { color: var(--accent2); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=color] { padding: 2px; height: 36px; width: 48px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

.btn {
  border: 1px solid var(--line); background: var(--panel2); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; white-space: nowrap; font-weight: 600;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1b0f05; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.big { font-size: 18px; padding: 14px 22px; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.row { display: flex; align-items: center; }
.gap { gap: 8px; } .wrap { flex-wrap: wrap; } .end { justify-content: flex-end; } .grow { flex: 1; }
.muted { color: var(--muted); } .small { font-size: 13px; }

header.top {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
header.top .logo { font-weight: 800; letter-spacing: .3px; }
header.top .logo b { color: var(--accent); }
header.top nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
header.top nav a.on, header.top nav a:hover { color: var(--text); background: var(--panel2); }

/* Desk */
.desk { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 460px); gap: 18px; padding: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.scan { font-size: 20px; padding: 14px 16px; width: 100%; border-radius: 10px; }
.stats { display: flex; gap: 14px; margin: 10px 0 4px; }
.stat { background: var(--panel2); padding: 6px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.stat b { color: var(--text); font-size: 16px; margin-right: 4px; }
table.people { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.people th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 6px 8px; }
table.people td { padding: 9px 8px; border-top: 1px solid var(--line); }
table.people tr { cursor: pointer; }
table.people tr:hover td { background: var(--panel2); }
table.people tr.sel td { background: #2a2440; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); }
.pill.ok { background: rgba(60,207,142,.15); color: var(--ok); }
.pill.warn { background: rgba(255,204,77,.14); color: var(--warn); }
.detail .preview { display: flex; justify-content: center; padding: 14px; background: repeating-conic-gradient(#1c1e33 0 25%, #16182a 0 50%) 0 0/20px 20px; border-radius: 10px; }
.detail .preview .badge-wrap { box-shadow: 0 10px 30px rgba(0,0,0,.5); border-radius: 3.2mm; overflow: hidden; }
.field { display: grid; gap: 4px; margin-top: 10px; }
.field label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.linkbox { display: flex; gap: 6px; }
.linkbox input { flex: 1; font-size: 13px; }
.qr { width: 110px; height: 110px; background: #fff; border-radius: 8px; padding: 6px; }
.empty { color: var(--muted); text-align: center; padding: 60px 20px; }
.status-line { margin-top: 10px; font-size: 14px; }

/* Designer */
.designer { display: grid; grid-template-columns: 1fr 380px; gap: 18px; padding: 18px; align-items: start; }
.stage { display: flex; align-items: center; justify-content: center; height: calc(100vh - 100px); min-height: 420px; background: repeating-conic-gradient(#1c1e33 0 25%, #16182a 0 50%) 0 0/20px 20px; border-radius: var(--r); position: sticky; top: 70px; }
.stage .badge-wrap { box-shadow: 0 14px 40px rgba(0,0,0,.6); }
.handle-box { position: absolute; outline: 2px dashed rgba(255,138,61,.9); cursor: move; touch-action: none; }
.handle-box.active { outline-style: solid; background: rgba(255,138,61,.08); }
.handle-box .tag { position: absolute; top: -22px; left: -2px; font-size: 11px; background: var(--accent); color: #1b0f05; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.handle-box .rs { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: var(--accent); border-radius: 3px; cursor: nwse-resize; }
.side h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent2); }
.side > h3:first-child { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.grid2 label, .grid4 label { font-size: 11px; color: var(--muted); display: grid; gap: 2px; }
.grid4 input { width: 100%; }
.side .savebar { position: sticky; bottom: 0; background: var(--panel); padding-top: 12px; margin-top: 16px; }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(5,6,15,.75); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; width: min(720px, 100%); max-height: 95vh; overflow: auto; }
.modal-box h3 { margin: 0 0 12px; }
.crop-area { height: min(60vh, 520px); background: #000; margin-bottom: 12px; }
.crop-area img { max-width: 100%; display: block; }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 20px rgba(0,0,0,.4); transition: opacity .4s; }
.toast.ok { border-color: var(--ok); } .toast.err { border-color: var(--err); }
.toast.out { opacity: 0; }

/* Upload-Seite */
.upl { max-width: 520px; margin: 0 auto; padding: 28px 16px 60px; text-align: center; }
.upl h1 { font-size: 26px; margin: 4px 0 6px; }
.upl .event { color: var(--accent2); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 13px; }
.upl .preview { display: flex; justify-content: center; margin: 22px 0; }
.upl .preview .badge-wrap { box-shadow: 0 14px 40px rgba(0,0,0,.6); border-radius: 3.2mm; overflow: hidden; }
.upl .hint { color: var(--muted); font-size: 14px; text-align: left; background: var(--panel); border-radius: 10px; padding: 12px 14px; margin-top: 18px; }
.upl .hint li { margin: 3px 0; }
.lock { background: rgba(255,204,77,.12); color: var(--warn); padding: 12px; border-radius: 10px; }

/* Login */
.login { max-width: 340px; margin: 14vh auto; padding: 0 16px; }
.login form { display: grid; gap: 10px; }

@media (max-width: 900px) {
  .desk, .designer { grid-template-columns: 1fr; }
  .stage { height: 70vh; position: relative; top: 0; }
  header.top { flex-wrap: wrap; }
}

/* Tabs im Designer */
.tabs { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); padding: 4px; border-radius: 10px; z-index: 2; }
.tab { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.on { background: var(--accent); color: #1b0f05; }
.stage #host { margin-top: 30px; }
textarea { resize: vertical; }

/* Rückseiten-Dialog */
.flip { text-align: center; }
.flip .steps { text-align: left; background: var(--panel2); border-radius: 10px; padding: 12px 14px 12px 34px; margin: 12px 0; }
.flip .steps li { margin: 4px 0; }
.sides { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.sides figure { margin: 0; text-align: center; }
.sides figcaption { font-size: 11px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .4px; }

/* Header: Event-Umschalter */
.evsel { display: flex; align-items: center; gap: 6px; }
.evsel select { max-width: 220px; padding: 6px 8px; }
.btn.small { padding: 5px 10px; font-size: 13px; }

/* Admin */
.admin { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 18px; padding: 18px; align-items: start; }
.admin h2 { margin: 0 0 10px; font-size: 18px; }
.admin h3 { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent2); }
.admin h4 { margin: 16px 0 6px; font-size: 14px; }
.admin .grid2 label { font-size: 12px; color: var(--muted); display: grid; gap: 3px; }
.evlist { display: grid; gap: 8px; }
.evitem { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.evitem:hover { border-color: var(--muted); }
.evitem.sel { border-color: var(--accent); }
.hint { background: var(--panel2); border-radius: 8px; padding: 8px 10px; color: var(--muted); }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* Designer: eigene Bilder */
.side h3.row { align-items: center; }
.imglist { display: flex; flex-wrap: wrap; gap: 6px; }
.imgchip { position: relative; width: 52px; height: 52px; border-radius: 8px; border: 2px solid var(--line); cursor: pointer;
  background: repeating-conic-gradient(#2a2d48 0 25%, #20233b 0 50%) 0 0/10px 10px; padding: 3px; }
.imgchip img { width: 100%; height: 100%; object-fit: contain; display: block; }
.imgchip span { position: absolute; top: -6px; right: -6px; background: var(--panel); border: 1px solid var(--line); font-size: 10px; border-radius: 99px; padding: 0 5px; }
.imgchip.on { border-color: var(--accent); }
.imgedit { background: var(--panel2); border-radius: 10px; padding: 10px; margin-top: 8px; }
.imgedit .grid4 input, .imgedit .grid4 select { width: 100%; }
.handle-box.img { outline-color: rgba(120,190,255,.9); }
.handle-box.img .tag, .handle-box.img .rs { background: #78beff; }

@media (max-width: 900px) { .admin { grid-template-columns: 1fr; } .evsel span { display: none; } }

/* Zuschneide-Dialog */
.crop-tools { margin-top: 10px; }
.crop-tools input[type=range] { accent-color: var(--accent); min-width: 120px; }
.crop-area .cropper-bg { background-size: 16px 16px; }
