:root {
  --bg: #f5f3ef; --surface: #fffefc; --ink: #1f1d1a; --muted: #77716a; --line: #e4dfd7;
  --accent: #b5532c; --accent-ink: #fff; --heart: #e0465c; --star: #e9a93a;
  --ok: #2f7d4f; --warn: #a86b12; --bad: #b3261e;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  color-scheme: light;
}
body.dark {
  --bg: #131313; --surface: #1d1d1c; --ink: #ecebe8; --muted: #9a958e; --line: #2e2d2b;
  --accent: #d9774c; --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
body.noscroll { overflow: hidden; }
h1 { font-size: 26px; margin: 4px 0; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
a { color: var(--accent); }
a.plain { color: inherit; text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bad); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.narrow-wrap { max-width: 760px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; margin-top: 12px; }
.wrap-row { flex-wrap: wrap; }
.center-row { justify-content: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } .wrap { padding: 0 14px; } h1 { font-size: 22px; } }

/* Formulare */
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
label input:not([type=checkbox]):not([type=range]), label textarea { display: block; width: 100%; margin-top: 5px; font-weight: 400; }
input[type=range] { width: 100%; padding: 0; margin-top: 10px; accent-color: var(--accent); }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 9px 15px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: transparent; }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.tiny { padding: 3px 8px; font-size: 12px; font-weight: 500; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin: 16px 0; }
.card.narrow { max-width: 400px; width: 100%; }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
dialog.card { max-width: 640px; width: calc(100% - 28px); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.5); }
.note { padding: 10px 14px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.note.ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.badge.accent { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.badge.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

/* Logo: eigenes Zeichen, ein Rahmen mit Markierungsecke */
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.logo-mark { width: 20px; height: 20px; border: 2.5px solid currentColor; border-radius: 4px; position: relative; }
.logo-mark::after { content: ""; position: absolute; right: -6px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }

/* Admin */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.topbar-right { display: flex; gap: 4px; align-items: center; }
@media (max-width: 560px) { .topbar-right .btn { padding: 5px 7px; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 16px 0 40px; }
.gcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .12s; }
.gcard:hover { transform: translateY(-2px); }
.gcover { aspect-ratio: 3/2; background: #ddd8cf; display: grid; place-items: center; }
.gcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gbody { padding: 12px 14px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 0; position: sticky; top: 57px; background: var(--bg); padding: 8px 0; z-index: 5; }
.steps a { text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
section[id], .card[id] { scroll-margin-top: 110px; }
.share-grid { display: grid; grid-template-columns: 3fr 1fr; gap: 12px; }
@media (max-width: 700px) { .share-grid { grid-template-columns: 1fr; } }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; transition: .15s; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.drop p { margin: 12px 0 6px; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px auto 6px; max-width: 420px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.result { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
blockquote { margin: 12px 0 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.tabs[hidden] { display: none; }
.tab { font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tab.active .muted { color: inherit; opacity: .7; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.admin-grid .empty { grid-column: 1 / -1; }
.acard { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.acard.liked { border-color: var(--heart); box-shadow: 0 0 0 1px var(--heart); }
.acard img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #ebe7e0; display: block; }
.acard figcaption { padding: 8px 9px; font-size: 12px; }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.heart-on { color: var(--heart); font-size: 16px; }
.stars-text { color: var(--star); letter-spacing: 1px; }
.comment { margin-top: 4px; color: var(--ink); background: var(--bg); padding: 5px 7px; border-radius: 6px; }
.acard-tools { margin-top: 6px; }
.acard-tools select { font-size: 12px; padding: 3px 4px; flex: 1; min-width: 0; }
.folder-tools { margin-top: 12px; }
.folder-tools input { padding: 5px 9px; }
.dl-admin { list-style: none; padding: 0; margin: 12px 0; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.dl-admin li { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.dl-admin li:last-child { border-bottom: 0; }
.dl-admin .fname { flex: 1; }
.delivery-form { margin-top: 12px; }
.wm-preview { width: 100%; border-radius: 8px; display: block; margin: 6px 0 14px; }

/* Kundengalerie */
.preview-note { background: var(--accent); color: #fff; text-align: center; font-size: 13px; padding: 6px; }
.client-head { padding: 40px 0 20px; }
.client-head .studio { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.client-head h1 { font-size: 32px; font-weight: 600; }
.intro { max-width: 720px; color: color-mix(in srgb, var(--ink) 85%, transparent); }
.client-bar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 6px 0; }
.client-bar .tabs { margin: 6px 0; }
.counter { font-weight: 600; white-space: nowrap; }
.counter.full { color: var(--heart); }
.done { margin-top: 16px; }
.ok-card { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.delivery { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.dl-single { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; }
.dl-single li { display: flex; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.dl-single li span { flex: 1; overflow: hidden; text-overflow: ellipsis; }

/* Ausgerichtetes Raster: gleiche Zeilenhöhe, Bildformat bleibt erhalten */
.justified { --rh: 240px; display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 60px; }
.justified .filler { flex-grow: 999; }
.tile { position: relative; cursor: zoom-in; background: #222; border-radius: 4px; overflow: hidden; }
.tile i { display: block; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.liked::after { content: ""; position: absolute; inset: 0; border: 3px solid var(--heart); border-radius: 4px; pointer-events: none; }
.tile-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; justify-content: space-between; padding: 22px 8px 6px; background: linear-gradient(transparent, rgba(0,0,0,.6)); opacity: 0; transition: opacity .15s; cursor: default; }
.tile:hover .tile-bar, .tile.liked .tile-bar { opacity: 1; }
@media (hover: none) { .tile-bar { opacity: 1; } }
.has-comment { font-size: 14px; margin-left: auto; }
.heart { font-size: 22px; line-height: 1; border: 0; background: none; color: rgba(255,255,255,.85); cursor: pointer; padding: 2px 4px; text-shadow: 0 1px 3px rgba(0,0,0,.5); transition: transform .1s; }
.heart:hover { transform: scale(1.15); }
.tile.liked .heart, .heart.on { color: var(--heart); }
.heart.big { font-size: 34px; }
.stars { display: inline-flex; }
.star { border: 0; background: none; padding: 0 1px; font-size: 15px; color: rgba(255,255,255,.4); cursor: pointer; line-height: 1; }
.star.on { color: var(--star); }
.stars.big .star { font-size: 26px; padding: 0 3px; }
body.locked .heart, body.locked .star { cursor: default; }

/* Großansicht */
.lb { position: fixed; inset: 0; background: #0b0b0b; z-index: 50; display: flex; flex-direction: column; }
.lb[hidden] { display: none; }
.lb figure { flex: 1; margin: 0; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 50px 60px 10px; }
.lb img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-bar { padding: 8px 20px 16px; max-width: 900px; width: 100%; margin: 0 auto; }
.lb-bar textarea { width: 100%; margin-top: 8px; background: #1b1b1b; border-color: #333; }
.lb-close { position: absolute; top: 10px; right: 14px; font-size: 22px; background: none; border: 0; color: #ddd; cursor: pointer; padding: 8px; z-index: 2; }
.lb-nav { position: absolute; top: 45%; font-size: 48px; background: none; border: 0; color: rgba(255,255,255,.6); cursor: pointer; padding: 10px 16px; z-index: 2; }
.lb-nav:hover { color: #fff; }
.lb-nav.prev { left: 0; } .lb-nav.next { right: 0; }
.hint { margin-top: 6px; }
@media (max-width: 700px) { .lb figure { padding: 46px 0 6px; } .lb-nav { display: none; } .hint { display: none; } .client-head { padding: 24px 0 12px; } .client-head h1 { font-size: 24px; } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px; z-index: 100; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 700px) {
  .justified { --rh: 150px; gap: 4px; }
  .client-bar .tabs { flex-wrap: nowrap; overflow-x: auto; margin: 4px 0; scrollbar-width: none; }
  .client-bar .tabs::-webkit-scrollbar { display: none; }
  .client-bar .tab { padding: 4px 10px; white-space: nowrap; }
  .client-bar .row.between { flex-wrap: wrap; row-gap: 0; }
  .tile .stars { display: none; }
  .tile-bar { justify-content: flex-end; padding: 18px 4px 3px; }
  .client-bar #folder-tabs { order: 2; width: 100%; }
  .client-bar .btn.primary { padding: 7px 12px; font-size: 14px; }
  .counter { font-size: 14px; }
  .intro { font-size: 14px; }
}

/* ---------- Farbmarkierungen, Auswahl, Filterleiste (v0.2) ---------- */
:root { --c-rot: #e0453a; --c-gelb: #e8c22c; --c-gruen: #4caf50; --c-blau: #3b82d6; --c-lila: #9b59b6; }
.c-rot { --c: var(--c-rot); } .c-gelb { --c: var(--c-gelb); } .c-gruen { --c: var(--c-gruen); } .c-blau { --c: var(--c-blau); } .c-lila { --c: var(--c-lila); }
.swatches { display: inline-flex; gap: 4px; align-items: center; vertical-align: middle; }
.sw { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; background: var(--c, transparent); padding: 0; cursor: pointer; font-size: 11px; line-height: 1; color: inherit; }
.sw-all, .sw-none { width: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; border-color: currentColor; opacity: .7; }
.sw.active { outline: 2px solid currentColor; outline-offset: 2px; opacity: 1; }
.cdot { position: absolute; top: 8px; right: 8px; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #fff; z-index: 2; pointer-events: none; }
.acard { position: relative; }
.acard .sel { position: absolute; top: 6px; left: 6px; z-index: 2; background: rgba(255,255,255,.9); border-radius: 4px; padding: 2px 4px; line-height: 0; cursor: pointer; }
.acard .sel input { width: 18px; height: 18px; margin: 0; }
.acard.selected { outline: 3px solid var(--accent, #3b82d6); outline-offset: -1px; }
.viewbar { gap: 14px; margin: 8px 0; font-size: 13px; }
.viewbar .inline, label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
.viewbar select { padding: 4px 6px; font-size: 13px; width: auto; }
.bulkbar { gap: 8px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; margin: 8px 0 12px; }
.bulkbar .bulk-actions { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; opacity: .45; pointer-events: none; }
.bulkbar.has-sel { border-style: solid; }
.bulkbar.has-sel .bulk-actions { opacity: 1; pointer-events: auto; }
.bulkbar select { padding: 3px 6px; font-size: 12px; width: auto; }
#filters .sort { padding: 4px 6px; font-size: 13px; width: auto; margin-left: auto; }
#filters .swatches { margin: 0 6px; }
.lb-colors { margin-right: 10px; }
