:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1c1a;
  --muted: #74716b;
  --line: #e4e1db;
  --accent: #c2410c;
  --accent-soft: #fdeee6;
  --ok: #15803d;
  --red: #e5484d; --yellow: #f5c518; --green: #30a46c; --blue: #3e8ef7; --purple: #8e4ec6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 15px; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: 8px 14px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
button:hover, .btn:hover { border-color: #cfcac2; background: #fbfaf8; }
button.primary { background: var(--text); color: #fff; border-color: var(--text); }
button.primary:hover { background: #3a3835; }
button.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
button.accent:hover { background: #a8380a; }
button.danger { color: #b42318; }
button.ghost { border-color: transparent; background: transparent; }
button:disabled { opacity: .5; cursor: default; }

input, textarea, select {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid #f3c7b1; border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
label.check input { width: auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.error { color: #b42318; font-size: 14px; min-height: 1.2em; margin-top: 8px; }

/* Anmeldung */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .brand { text-align: center; margin-bottom: 22px; }
.login-box .brand .logo { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.login-box button { width: 100%; justify-content: center; margin-top: 18px; padding: 11px; }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(246,245,242,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1600px; margin: 0 auto; padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.topbar .title { flex: 1; min-width: 180px; }
.topbar .title .studio { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.topbar .title h1 { font-size: 20px; margin: 0; }
.counter { font-variant-numeric: tabular-nums; font-weight: 600; }
.counter .of { color: var(--muted); font-weight: 400; }

.filters { max-width: 1600px; margin: 0 auto; padding: 10px 16px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border-radius: 999px; padding: 5px 12px; font-size: 13px; border: 1px solid var(--line); background: var(--surface);
}
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.chip .n { opacity: .6; margin-left: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.red { background: var(--red); } .dot.yellow { background: var(--yellow); } .dot.green { background: var(--green); }
.dot.blue { background: var(--blue); } .dot.purple { background: var(--purple); }

.notice { max-width: 1600px; margin: 12px auto 0; padding: 0 16px; }
.notice > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; white-space: pre-line; }
.notice .done { background: #ecfdf3; border-color: #b7ebc6; color: #0f5132; }

/* Blocksatz-Raster */
.grid { max-width: 1600px; margin: 0 auto; padding: 14px 12px 80px; display: flex; flex-wrap: wrap; gap: 8px; }
.grid::after { content: ""; flex-grow: 999; }
.tile { position: relative; background: #e9e6e0; border-radius: 6px; overflow: hidden; cursor: zoom-in; }
.tile > i { display: block; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.tile.selected::after { content: ""; position: absolute; inset: 0; border: 3px solid var(--accent); border-radius: 6px; pointer-events: none; z-index: 1; }
.tile .bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.55)); color: #fff; font-size: 12px; opacity: 0; transition: opacity .15s; z-index: 2;
}
.tile:hover .bar, .tile.selected .bar, .tile.has-marks .bar { opacity: 1; }
.tile .bar .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity .15s; }
.tile:hover .bar .name { opacity: .9; }
.heart {
  border: 0; background: transparent; padding: 2px; color: #fff; display: grid; place-items: center; cursor: pointer;
}
.heart svg { width: 24px; height: 24px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.heart.on svg path { fill: var(--accent); stroke: var(--accent); }
.heart:hover { background: transparent; }
.tile .comment-ico { font-size: 13px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: #111; color: #eee; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lb-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 14px; }
.lb-top .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stage { position: relative; min-height: 0; overflow: hidden; }
.lb-stage img {
  position: absolute; top: 0; bottom: 0; left: 56px; right: 56px; width: calc(100% - 112px); height: 100%;
  object-fit: contain; user-select: none; -webkit-user-drag: none;
}
.lb-top, .lb-bottom { position: relative; z-index: 2; background: #111; }
.lb-nav { z-index: 1; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 8px;
  background: rgba(255,255,255,.08); color: #fff; font-size: 26px; justify-content: center;
}
.lb-nav:hover { background: rgba(255,255,255,.18); }
.lb-prev { left: 6px; } .lb-next { right: 6px; }
.lb-bottom { display: flex; align-items: center; gap: 14px; padding: 12px 14px; flex-wrap: wrap; border-top: 1px solid #262626; }
.lightbox button.dark { background: #222; color: #eee; border-color: #333; }
.lightbox button.dark:hover { background: #2c2c2c; }
.lb-heart.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.colors { display: flex; gap: 6px; align-items: center; }
.colors button { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid transparent; justify-content: center; }
.colors button.none { background: #333; color: #aaa; font-size: 13px; }
.colors button.on { border-color: #fff; box-shadow: 0 0 0 2px #111 inset; }
.colors button.red { background: var(--red); } .colors button.yellow { background: var(--yellow); } .colors button.green { background: var(--green); }
.colors button.blue { background: var(--blue); } .colors button.purple { background: var(--purple); }
.lb-comment { flex: 1; min-width: 200px; }
.lb-comment textarea { background: #1b1b1b; color: #eee; border-color: #333; resize: none; height: 40px; }
.lb-help { font-size: 12px; color: #888; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* Admin */
.wrap { max-width: 1200px; margin: 0 auto; padding: 20px 16px 80px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.gal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 16px; }
.gal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s; }
.gal-card:hover { transform: translateY(-2px); }
.gal-card .cover { aspect-ratio: 3/2; background: #e9e6e0 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.gal-card .body { padding: 12px 14px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #efede8; color: var(--muted); }
.badge.ok { background: #ecfdf3; color: var(--ok); }
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 120px 1fr auto; gap: 6px 10px; align-items: center; }
.kv code { background: #f3f1ed; padding: 4px 8px; border-radius: 6px; font-size: 14px; overflow-wrap: anywhere; }
.drop {
  border: 2px dashed #d3cec5; border-radius: var(--radius); padding: 28px 16px; text-align: center; color: var(--muted);
  background: var(--surface); margin-top: 16px; cursor: pointer;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.progress { height: 6px; background: #ece9e3; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.ag { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ag.selected { outline: 3px solid var(--accent); outline-offset: -1px; }
.ag img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #e9e6e0; }
.ag .meta { padding: 6px 8px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.ag .meta .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag .cmt { padding: 0 8px 8px; font-size: 12px; color: var(--text); white-space: pre-wrap; }
.ag .del { position: absolute; top: 6px; right: 6px; padding: 3px 7px; font-size: 12px; opacity: 0; }
.ag:hover .del { opacity: 1; }
.ag .sel { position: absolute; top: 6px; left: 6px; background: var(--accent); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: 12px; }
dialog { border: 0; border-radius: var(--radius); padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(560px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { padding: 22px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
textarea.invite { height: 220px; font-size: 14px; }

@media (max-width: 700px) {
  .lb-help { display: none; }
  .lb-stage img { left: 0; right: 0; width: 100%; }
  .lb-nav { width: 36px; height: 52px; background: rgba(0,0,0,.35); }
  .lb-bottom { gap: 10px; }
  .lb-comment { min-width: 100%; order: 3; }
  .topbar .title h1 { font-size: 17px; }
  .grid { gap: 4px; padding: 8px 4px 80px; }
  .tile .bar { opacity: 1; background: linear-gradient(transparent, rgba(0,0,0,.35)); }
}

/* Lieferung / Downloads */
.tabs { max-width: 1600px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 12px; color: var(--muted); }
.tabs button:hover { background: transparent; color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.btn.accent-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent-btn:hover { background: #a8380a; }
.btn svg { width: 18px; height: 18px; }
a.heart { text-decoration: none; }
.lightbox .btn.dark { background: #222; color: #eee; border-color: #333; }
.lightbox .btn.dark:hover { background: #2c2c2c; }
.delivery-grid .ag img { aspect-ratio: auto; height: 140px; }
.switch-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.switch-row input[type=date] { width: auto; }
@media (max-width: 700px) {
  .btn.accent-btn { flex: 1; justify-content: center; }
}
