/* Galerie – Grundstil. Akzentfarbe kommt aus den Einstellungen (--accent). */
:root {
  --bg: #0c1326;
  --panel: #141d36;
  --panel2: #1c2744;
  --line: #2a365a;
  --text: #eef1f7;
  --muted: #9aa6c0;
  --accent: #c5d400;
  --navy: #1e2d4f;
  --accent-ink: #111;
  --danger: #e5484d;
  --radius: 10px;
  --present-bg: #111;
  --gap: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column; }
body.noscroll { overflow: hidden; }
a { color: inherit; }
h1 { font-size: 26px; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 22px 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: #ff8a8d; background: #3a1416; padding: 8px 12px; border-radius: 8px; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap { gap: 10px; }
.grow { flex: 1; }
.center { text-align: center; }

/* Kopfzeile */
.topbar { display: flex; align-items: center; gap: 20px; padding: 8px 20px; border-bottom: 3px solid var(--accent); background: #fff; color: var(--navy); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.brand img { height: 52px; width: auto; }
.brand span { color: var(--navy); }
.brand img + span { display: none; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.nav a { text-decoration: none; color: var(--navy); font-weight: 600; }
.nav a:hover { color: #000; }
.topbar .linkbtn { color: var(--navy); font-weight: 600; }
.topbar .muted { color: #5b6784; }
.gtitle { margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flash { background: var(--accent); color: var(--accent-ink); padding: 10px 20px; font-weight: 600; }
.main { padding: 24px 20px 60px; max-width: 1400px; width: 100%; margin: 0 auto; flex: 1; }
.footer { padding: 18px; text-align: center; font-size: 13px; color: var(--muted); display: flex; gap: 18px; justify-content: center; }
.footer a { color: var(--muted); }

/* Bausteine */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 40px auto; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form.wide { max-width: 820px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 6px 16px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
input[type=color] { padding: 2px; height: 40px; }
input[type=range] { width: 120px; padding: 0; accent-color: var(--accent); background: none; border: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.sel { width: auto; padding: 6px 8px; font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #444; background: #2a2a2e; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: #ff8a8d; border-color: #5a2427; }
.btn.danger:hover { background: #3a1416; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.linkbtn:hover { color: var(--text); }
.badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.65); padding: 2px 8px; border-radius: 99px; font-style: normal; font-size: 12px; }
.badge.warn { right: auto; left: 8px; background: #7a4a00; }
details > summary { cursor: pointer; font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 14px; }

/* Dashboard */
.newgal { display: grid; grid-template-columns: 2fr 1.4fr auto; gap: 10px; }
.galgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.galcard { text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, transform .15s; }
.galcard:hover { border-color: #555; transform: translateY(-2px); }
.galcover { position: relative; aspect-ratio: 3/2; background: #222 center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.galmeta { padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.sharebox input { flex: 1; min-width: 240px; }
.panels { display: grid; gap: 0; }
.activity { max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }

/* Galerie-Oberfläche */
body.client { background: var(--bg); }
.app { width: 100%; }
body.client .app { padding: 0 20px 40px; }
.toolbar { position: sticky; top: 71px; z-index: 15; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); padding: 10px 0; border-bottom: 1px solid var(--line); margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.app.admin .toolbar { top: 71px; }
.tb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.tabs button.on { background: var(--text); color: var(--bg); }
.tabs button:hover:not(.on) { color: var(--text); background: var(--panel2); }
.chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 99px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; font-style: normal; }
.guestbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -4px 0 14px; }
.bulkbar { position: sticky; top: 140px; z-index: 14; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; }
.bulkbar .linkbtn { color: var(--accent-ink); text-decoration: underline; }
.bulkbar .sel { background: #fff; color: #111; }
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; min-width: 210px; padding: 6px; z-index: 30; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.dd-menu a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; font-size: 14px; }
.dd-menu a:hover { background: #333; }

.grid { --tile: 220px; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; position: relative; transition: border-color .12s; }
.tile:hover { border-color: #4a4a50; }
.tile.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tile.dragging { opacity: .4; }
.thumb { position: relative; aspect-ratio: 1; background: #141416; display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 34px; color: var(--muted); text-align: center; padding: 10px; }
.ph small { font-size: 12px; word-break: break-all; }
.ph.big { font-size: 60px; gap: 14px; }
.mycolor { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.others { position: absolute; left: 10px; top: 8px; display: flex; gap: 3px; }
.others .dot { width: 10px; height: 10px; box-shadow: 0 0 0 1.5px rgba(0,0,0,.6); }
.heart { position: absolute; right: 6px; top: 4px; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; text-shadow: 0 1px 4px rgba(0,0,0,.8); opacity: .0; transition: opacity .12s, transform .12s; padding: 2px 4px; }
.heart.on { color: #ff4d6d; opacity: 1; }
.tile:hover .heart { opacity: 1; }
.heart:hover { transform: scale(1.15); }
.selbox { position: absolute; left: 8px; bottom: 8px; opacity: 0; transition: opacity .12s; }
.tile:hover .selbox, .tile.sel .selbox { opacity: 1; }
.hoverbar { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.tile:hover .hoverbar { opacity: 1; }
.hoverbar button { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(0,0,0,.4); cursor: pointer; padding: 0; }
.hoverbar button.on { border-color: #fff; }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 7px 10px; font-size: 12px; }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.stats { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.vtag { background: #333; border-radius: 4px; padding: 0 5px; font-size: 11px; }
.status { font-size: 11px; background: #333; border-radius: 4px; padding: 1px 6px; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.s-selected { background: #1d4ed8; } .s-retouch { background: #a16207; } .s-final { background: #15803d; } .s-rejected { background: #7f1d1d; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; grid-column: 1 / -1; }

/* Präsentation */
body.present, body.present .toolbar { background: var(--present-bg); }
body.present .toolbar { border-bottom-color: transparent; }
.pgrid { --tile: 300px; column-width: var(--tile); column-gap: var(--gap); }
.ptile { margin: 0 0 var(--gap); break-inside: avoid; cursor: zoom-in; background: rgba(255,255,255,.03); }
.ptile img { width: 100%; height: auto; display: block; }
.ptile .ph { aspect-ratio: 3/2; }

/* Upload */
.uploads { position: fixed; right: 16px; bottom: 16px; width: 340px; max-height: 50vh; overflow: auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; z-index: 60; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.up { display: grid; grid-template-columns: 1fr 80px 34px; gap: 8px; align-items: center; font-size: 12px; }
.upname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upbar { height: 6px; background: #333; border-radius: 3px; overflow: hidden; }
.upbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up.err .upbar i { background: var(--danger); }
.uppct { text-align: right; }
.dropzone { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.dropzone div { border: 3px dashed var(--accent); border-radius: 20px; padding: 60px 80px; font-size: 24px; font-weight: 700; }

/* Modal & Toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: 100%; max-width: 420px; }
.modal-box h2 { margin-top: 0; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; font-size: 14px; opacity: 0; transition: .2s; z-index: 200; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Lightbox */
.lb { position: fixed; inset: 0; z-index: 90; background: #050505; display: grid; grid-template-columns: 1fr 360px; }
.lb.present { grid-template-columns: 1fr; background: var(--present-bg); }
.lb.present .lb-side { position: absolute; right: 16px; bottom: 16px; background: none; border: 0; padding: 0; width: auto; overflow: visible; }
.lb-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.lb-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbbtn { background: none; border: 0; color: var(--text); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.lbbtn:hover { background: #222; }
.vbtn { background: #222; border: 1px solid #333; color: var(--text); font-size: 12px; border-radius: 6px; padding: 3px 8px; cursor: pointer; margin-right: 3px; }
.vbtn.on { border-color: var(--accent); color: var(--accent); }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0 56px 20px; }
.lb-stage.zoomed { overflow: auto; display: block; padding: 0; cursor: grab; }
.lb-stage.zoomed.panning { cursor: grabbing; }
.imgwrap { position: relative; display: inline-block; line-height: 0; max-width: 100%; max-height: 100%; }
.imgwrap img { display: block; user-select: none; -webkit-user-drag: none; background: #111; }
.imgwrap img:not([style]) { max-width: 100%; max-height: calc(100vh - 90px); }
.lb-stage.zoomed .imgwrap { max-width: none; max-height: none; }
.lb-stage.zoomed .imgwrap img { max-width: none; max-height: none; }
.imgwrap.tool { cursor: crosshair; }
.ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ov.drawing { pointer-events: auto; cursor: crosshair; touch-action: none; }
.ov polyline { fill: none; stroke: #ff3b3b; stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke; cursor: pointer; }
.ov polyline.pending { stroke: var(--accent); }
.ov polyline.done { stroke: #30a46c; opacity: .6; }
.pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%; background: #ff3b3b; color: #fff; font-size: 12px; font-weight: 700; font-style: normal; display: flex; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(0,0,0,.6); pointer-events: auto; cursor: pointer; }
.pin.pending { background: var(--accent); color: #111; }
.pin.done { background: #30a46c; }
.lb-stage video { max-width: 100%; max-height: calc(100vh - 90px); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.06); border: 0; color: #fff; font-size: 34px; width: 44px; height: 70px; border-radius: 8px; cursor: pointer; }
.lb-nav:hover { background: rgba(255,255,255,.15); }
.lb-nav.prev { left: 6px; } .lb-nav.next { right: 6px; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; height: 100%; }
.cmp figure { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.cmp img { max-width: 100%; max-height: calc(100vh - 130px); }
.cmp figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.lb-side { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.sec { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.sec:last-child { border-bottom: 0; }
.markrow { display: flex; align-items: center; gap: 8px; }
.cbtn { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; opacity: .55; }
.cbtn.on { border-color: #fff; opacity: 1; }
.cbtn:hover { opacity: 1; }
.heartbig { margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text); font-size: 22px; border-radius: 8px; padding: 0 12px; cursor: pointer; }
.heartbig.on { color: #ff4d6d; border-color: #ff4d6d; }
.markers { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.markers li { display: flex; align-items: center; gap: 5px; }
.admin-tools label { flex-direction: row; align-items: center; gap: 8px; }
.cmt { background: var(--panel2); border-radius: 8px; padding: 8px 10px; font-size: 14px; transition: box-shadow .3s; }
.cmt.done { opacity: .55; }
.cmt.done .cmt-b { text-decoration: line-through; }
.cmt.otherv { opacity: .7; }
.cmt.flash { box-shadow: 0 0 0 2px var(--accent); }
.cmt-h { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.pinno { background: #ff3b3b; color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; flex: none; }
.composer { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.keys { line-height: 1.6; }

@media (max-width: 860px) {
  .lb { grid-template-columns: 1fr; grid-template-rows: 60vh auto; overflow-y: auto; }
  .lb-side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .lb-stage { padding: 0 8px 10px; }
  .imgwrap img, .lb-stage video { max-height: calc(60vh - 60px); }
  .lb-nav { width: 34px; height: 54px; font-size: 26px; }
  .newgal { grid-template-columns: 1fr; }
  .toolbar { top: 49px; }
  .heart, .hoverbar, .selbox { opacity: 1; }
  .keys { display: none; }
  .uploads { left: 16px; width: auto; }
  .main, body.client .app { padding-left: 16px; padding-right: 16px; }
  .gtitle { font-size: 13px; }
  .cmp { grid-template-columns: 1fr; }
}

/* Untergalerien */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.crumbs > button:not(.btn):not(.linkbtn) { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 700; font-size: 16px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.crumbs > button.on { color: var(--text); }
.crumbs > button:not(.btn):not(.linkbtn):hover { background: var(--panel2); color: var(--text); }
.crumbs .sep { color: var(--muted); }
.subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.subcard { display: flex; flex-direction: column; gap: 3px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 0 10px; overflow: hidden; cursor: pointer; color: var(--text); font: inherit; }
.subcard:hover { border-color: var(--accent); }
.subcover { aspect-ratio: 3/2; background: var(--panel2) center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 34px; margin-bottom: 6px; }
.subname { font-weight: 700; padding: 0 12px; }
.subcard .small { padding: 0 12px; }

/* Kunden */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.custbox { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.custlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 16px; }

/* Anmeldeseiten mit Hintergrundbild */
body.auth {
  background:
    linear-gradient(180deg, rgba(8,14,32,.35) 0%, rgba(8,14,32,.75) 100%),
    var(--auth-bg, radial-gradient(circle at 18% 22%, rgba(197,212,0,.35) 0, transparent 38%),
                   radial-gradient(circle at 85% 80%, rgba(62,99,221,.45) 0, transparent 45%),
                   linear-gradient(135deg, #0c1326 0%, #1e2d4f 100%));
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
body.auth .main { display: flex; align-items: center; justify-content: center; }
body.auth .card.narrow {
  margin: 40px auto;
  background: rgba(16, 24, 46, .72);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-color: rgba(255,255,255,.12);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  width: 100%;
}
body.auth .footer { background: rgba(8,14,32,.55); backdrop-filter: blur(6px); }
.footer { flex-wrap: wrap; align-items: center; }
.footer span { color: var(--muted); }
.legal { max-width: 820px; margin: 0 auto; line-height: 1.65; }
.legal h2 { margin-top: 28px; }
.legal .muted { font-size: 13px; }
@media (max-width: 860px) { body.auth { background-attachment: scroll; } }
