:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #efeeea;
  --text: #1b1c1e;
  --muted: #6c6d70;
  --line: #e2e1dc;
  --accent: #e8642c;
  --accent-text: #ffffff;
  --tile: #e6e5e0;
  --shadow: 0 10px 30px rgba(20, 20, 20, .12);
  --radius: 14px;
  --top: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1a1b1e;
    --surface-2: #232428;
    --text: #ededee;
    --muted: #9a9ba0;
    --line: #2b2c31;
    --accent: #ff7a45;
    --accent-text: #160a04;
    --tile: #1f2023;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.err { color: #e5484d; min-height: 1.4em; margin: 0; font-size: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 9px 16px; border-radius: 999px; font-weight: 600;
  transition: transform .1s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; background: transparent; border-radius: 50%; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { width: 30px; height: 30px; }
.icon-btn.small svg { width: 18px; height: 18px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 6px 13px; border-radius: 999px; font-size: 14px; font-weight: 500;
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .06em; font-size: 15px; }
.brand.big { font-size: 22px; justify-content: center; }
.logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent); position: relative; flex: none;
}
.logo::after {
  content: ""; position: absolute; inset: 8px; border: 2.5px solid #fff; border-radius: 50%;
}

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px 24px; display: grid; gap: 14px; text-align: center; box-shadow: var(--shadow);
}
.login-card p { margin: 0; }
.login-card input {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card .btn { justify-content: center; padding: 12px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border-radius: 999px; padding: 0 14px; height: 40px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); }
.filters { display: flex; gap: 6px; }
#uploadBtn { margin-left: auto; }
.menu {
  position: absolute; right: 16px; top: calc(var(--top) - 4px); width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px;
}
.storage { font-size: 13px; color: var(--muted); display: grid; gap: 6px; }
.storage strong { color: var(--text); font-size: 14px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.menu-item { text-align: left; border: 0; background: var(--surface-2); padding: 9px 12px; border-radius: 10px; }

/* Main / Timeline */
main { padding: 8px 20px 120px; max-width: 1600px; margin: 0 auto; padding-right: 64px; }
.stats { color: var(--muted); font-size: 13px; padding: 14px 2px 0; }
.month { margin-top: 18px; }
.month-head {
  position: sticky; top: var(--top); z-index: 5; padding: 12px 2px 8px;
  background: var(--bg); font-size: 22px; font-weight: 750; letter-spacing: -.01em;
  display: flex; align-items: baseline; gap: 10px;
}
.month-head small { font-size: 13px; font-weight: 500; color: var(--muted); }
.day-head { font-size: 14px; font-weight: 600; color: var(--muted); padding: 14px 2px 8px; display: flex; gap: 8px; }
.day-head span { color: var(--text); }
.grid {
  display: grid; gap: 4px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.tile {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; overflow: hidden;
  background: var(--tile); border-radius: 6px; cursor: zoom-in;
}
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity .25s, transform .3s;
}
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.03); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile .badge {
  position: absolute; right: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: #fff; background: rgba(0,0,0,.55);
  padding: 2px 7px 2px 5px; border-radius: 99px; backdrop-filter: blur(4px);
}
.tile .badge svg { width: 12px; height: 12px; fill: #fff; stroke: none; }
.tile .fmt {
  position: absolute; left: 6px; top: 6px; font-size: 10px; font-weight: 700; letter-spacing: .05em;
  color: #fff; background: rgba(0,0,0,.45); padding: 2px 6px; border-radius: 5px;
}
.tile .noprev {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted);
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
}
.tile.fresh { animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(.9); opacity: .2; } to { transform: none; opacity: 1; } }

/* Scrubber */
.scrubber {
  position: fixed; right: 8px; top: calc(var(--top) + 16px); bottom: 16px; width: 48px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px; overflow-y: auto; scrollbar-width: none;
  font-size: 11px;
}
.scrubber::-webkit-scrollbar { display: none; }
.scrubber a { color: var(--muted); text-decoration: none; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.scrubber a.year { color: var(--text); font-weight: 700; font-size: 12px; margin-top: 6px; }
.scrubber a:hover, .scrubber a.current { background: var(--surface-2); color: var(--accent); }

/* Empty */
.empty { text-align: center; padding: 12vh 16px; display: grid; justify-items: center; gap: 6px; }
.empty h2 { margin: 18px 0 0; font-size: 24px; }
.empty p { margin: 0 0 16px; max-width: 420px; }
.empty-art {
  width: 120px; height: 90px; border-radius: 18px; position: relative;
  background: linear-gradient(135deg, var(--accent), #ffb347);
  transform: rotate(-6deg); box-shadow: var(--shadow);
}
.empty-art::before {
  content: ""; position: absolute; inset: 0; border-radius: 18px; background: var(--surface-2);
  transform: rotate(12deg) translate(14px, -6px); z-index: -1;
}
.empty-art::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px;
  border: 4px solid #fff; border-radius: 50%;
}

/* Drop overlay */
.drop {
  position: fixed; inset: 0; z-index: 50; padding: 16px;
  background: color-mix(in srgb, var(--accent) 18%, rgba(0,0,0,.5));
  display: grid; place-items: center; backdrop-filter: blur(3px);
}
.drop-inner {
  width: min(560px, 100%); aspect-ratio: 16/9; border: 3px dashed #fff; border-radius: 24px; color: #fff;
  display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; padding: 16px;
}
.drop-inner svg { width: 48px; height: 48px; }
.drop-inner strong { font-size: 22px; }

/* Uploads panel */
.uploads {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: min(380px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.uploads header { display: flex; align-items: center; gap: 4px; padding: 10px 8px 10px 16px; }
.uploads header strong { flex: 1; font-size: 14px; }
.uploads.collapsed ul { display: none; }
.uploads.collapsed #upToggle svg { transform: rotate(180deg); }
.up-total { height: 3px; background: var(--surface-2); }
.up-total div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#upList { list-style: none; margin: 0; padding: 6px 0; max-height: 300px; overflow-y: auto; }
#upList li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 16px; font-size: 13px; }
#upList .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#upList .s { color: var(--muted); font-variant-numeric: tabular-nums; }
#upList .bar { grid-column: 1 / -1; height: 3px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
#upList .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
#upList li.done .s { color: #30a46c; }
#upList li.dup .s { color: var(--muted); }
#upList li.fail .s { color: #e5484d; }
#upList li.done .bar, #upList li.dup .bar, #upList li.fail .bar { display: none; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; }
.lb-top {
  position: absolute; inset: 0 0 auto; z-index: 3; display: flex; align-items: center; gap: 4px;
  padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  background: linear-gradient(rgba(0,0,0,.7), transparent);
}
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255,255,255,.14); }
.lb-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; padding: 0 6px; }
.lb-title strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-title span { font-size: 12px; opacity: .7; }
.lb-stage { position: absolute; inset: 0; display: grid; place-items: center; touch-action: pan-y; }
.lb-stage img, .lb-stage video { width: 100vw; height: 100vh; height: 100dvh; object-fit: contain; display: block; }
.lb-stage .msg { text-align: center; display: grid; gap: 12px; justify-items: center; padding: 16px; color: #ccc; }
.lb-nav {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); width: 48px; height: 48px;
  border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #fff;
}
.lb-nav:hover { background: rgba(255,255,255,.24); }
.lb-nav.prev { left: 16px; }
.lb-nav.next { right: 16px; }
.lb-info {
  position: absolute; right: 0; top: 0; bottom: 0; z-index: 4; width: min(320px, 100%);
  background: #16171a; padding: 70px 20px 20px; overflow-y: auto; font-size: 14px;
}
.lb-info dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; }
.lb-info dt { color: #999; }
.lb-info dd { margin: 0; word-break: break-word; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}

/* Mobile */
@media (max-width: 760px) {
  :root { --top: 108px; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 10px; gap: 8px; }
  .brand-text { display: none; }
  .search { order: 5; flex-basis: 100%; max-width: none; height: 38px; }
  .filters { order: 2; }
  .chip { padding: 5px 10px; }
  #uploadBtn { order: 3; padding: 8px 12px; }
  #uploadBtn span { display: none; }
  #menuBtn { order: 4; }
  main { padding: 0 16px 120px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 3px; }
  .tile { border-radius: 3px; }
  .month-head { font-size: 19px; }
  .scrubber { display: none; }
  .lb-nav { display: none; }
  .uploads { right: 16px; bottom: 16px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---------- Editor ---------- */
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.25); color: #fff; }
.editor { position: fixed; inset: 0; z-index: 65; background: #0b0b0c; color: #fff; display: flex; flex-direction: column; }
.ed-top {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
}
.ed-top strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 16px; position: relative; overflow: hidden; }
.ed-canvas-wrap { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
.ed-canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.crop-box {
  position: absolute; border: 1.5px solid #fff; cursor: move; touch-action: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.6);
  background-image:
    linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)), linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)),
    linear-gradient(90deg, rgba(255,255,255,.35), rgba(255,255,255,.35)), linear-gradient(90deg, rgba(255,255,255,.35), rgba(255,255,255,.35));
  background-size: 100% 1px, 100% 1px, 1px 100%, 1px 100%;
  background-position: 0 33.33%, 0 66.66%, 33.33% 0, 66.66% 0;
  background-repeat: no-repeat;
}
.ed-canvas-wrap { overflow: hidden; }
.crop-box .h { position: absolute; width: 28px; height: 28px; touch-action: none; }
.crop-box .h::after { content: ""; position: absolute; width: 16px; height: 16px; border: 3.5px solid #fff; }
.crop-box .h.nw { left: -8px; top: -8px; cursor: nwse-resize; } .crop-box .h.nw::after { left: 4px; top: 4px; border-right: 0; border-bottom: 0; }
.crop-box .h.ne { right: -8px; top: -8px; cursor: nesw-resize; } .crop-box .h.ne::after { right: 4px; top: 4px; border-left: 0; border-bottom: 0; }
.crop-box .h.sw { left: -8px; bottom: -8px; cursor: nesw-resize; } .crop-box .h.sw::after { left: 4px; bottom: 4px; border-right: 0; border-top: 0; }
.crop-box .h.se { right: -8px; bottom: -8px; cursor: nwse-resize; } .crop-box .h.se::after { right: 4px; bottom: 4px; border-left: 0; border-top: 0; }
.ed-tools {
  padding: 12px 16px max(16px, env(safe-area-inset-bottom)); display: grid; gap: 12px; justify-items: center;
  background: #121214; border-top: 1px solid #222;
}
.ed-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid #333; background: #1c1c1f; color: #eee;
  padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 500;
}
.tool:hover { background: #26262a; }
.tool.active { background: #fff; color: #111; border-color: #fff; }
.tool svg { width: 18px; height: 18px; }
.tool.link { background: transparent; border-color: transparent; color: var(--accent); }
.ed-stage video { max-width: 100%; max-height: 100%; transition: transform .25s; background: #000; }
.trim { width: min(640px, 100%); display: grid; gap: 8px; }
.trim-bar { position: relative; height: 34px; border-radius: 8px; background: #1c1c1f; cursor: pointer; touch-action: none; }
.trim-sel { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 30%, transparent); border: 2px solid var(--accent); border-radius: 8px; }
.trim-play { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; pointer-events: none; }
.trim-h { position: absolute; top: 0; bottom: 0; width: 18px; margin-left: -9px; cursor: ew-resize; touch-action: none; }
.trim-h::after { content: ""; position: absolute; left: 6px; top: 7px; bottom: 7px; width: 6px; border-radius: 3px; background: var(--accent); }
.trim-info { display: flex; justify-content: space-between; font-size: 12px; color: #aaa; font-variant-numeric: tabular-nums; }
.ed-note { font-size: 12px; color: #888; text-align: center; margin: 0; max-width: 520px; }
.ed-busy { position: absolute; inset: 0; z-index: 3; background: rgba(0,0,0,.7); display: grid; place-content: center; justify-items: center; gap: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Dialog / Teilen ---------- */
.dlg-backdrop { position: fixed; inset: 0; z-index: 75; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 16px; }
.dlg {
  width: min(480px, 100%); max-height: 85vh; overflow: auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 16px 18px 18px;
}
.dlg header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dlg header strong { font-size: 17px; }
.share-new { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.share-new label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); flex: 1; min-width: 140px; }
.share-new select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
}
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.hint:empty { display: none; }
.share-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.share-list:empty { display: none; }
.share-list li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.share-list .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.share-list .meta strong { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-url { display: flex; gap: 6px; }
.share-url input {
  flex: 1; min-width: 0; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
}
.share-url .btn { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: #e5484d; }
.tile .edited {
  position: absolute; left: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); display: grid; place-items: center;
}
.tile .edited svg { width: 12px; height: 12px; stroke: #fff; }
@media (max-width: 760px) {
  .ed-top .btn { padding: 7px 12px; }
  .tool { padding: 7px 10px; }
  .tool span { display: none; }
  .tool.keep span { display: inline; }
}

/* ---------- Mehrfachauswahl ---------- */
.selbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 25; height: var(--top);
  display: flex; align-items: center; gap: 6px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
}
.sel-info { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.sel-info strong { font-size: 16px; white-space: nowrap; }
.sel-info span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.sel-btn {
  display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--text);
  padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: 14px;
}
.sel-btn:hover { background: var(--surface-2); }
.sel-btn.danger { color: #e5484d; }
.tile .check {
  position: absolute; left: 7px; top: 7px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9); background: rgba(0,0,0,.25); box-shadow: 0 1px 4px rgba(0,0,0,.35);
  opacity: 0; transition: opacity .15s, background .15s, transform .15s; z-index: 2;
}
.tile:hover .check, body.selecting .tile .check { opacity: 1; }
.tile .check:hover { transform: scale(1.1); }
.tile.selected .check { background: var(--accent); border-color: var(--accent); }
.tile.selected .check::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.tile img, .tile .noprev { transition: opacity .25s, transform .2s, border-radius .2s; }
.tile.selected img { transform: scale(.86); border-radius: 6px; }
.tile.selected { background: color-mix(in srgb, var(--accent) 22%, var(--tile)); }
.tile.selected:hover img { transform: scale(.86); }
body.selecting .tile { cursor: pointer; }
.tile .fmt { left: auto; right: 6px; }
.day-head { align-items: center; }
.day-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: transparent;
  padding: 0; margin-left: 4px; opacity: 0; transition: opacity .15s; position: relative;
}
.day-head:hover .day-check, body.selecting .day-check { opacity: 1; }
.day-check.on { background: var(--accent); border-color: var(--accent); }
.day-check.on::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 4px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.share-new .title-field { flex-basis: 100%; }
.share-new input[type=text] {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
}
@media (hover: none) { .day-check { opacity: 1; } }
@media (max-width: 760px) {
  .sel-btn span { display: none; }
  .sel-btn { padding: 9px; }
  .sel-info { flex-direction: column; gap: 0; }
  .sel-info span { font-size: 12px; }
}

/* ---------- Seitenleiste ---------- */
:root { --side: 236px; }
.nav-btn { margin-left: -6px; }
.sidebar {
  position: fixed; left: 0; top: var(--top); bottom: 0; width: var(--side); z-index: 15;
  overflow-y: auto; padding: 14px 10px 40px; border-right: 1px solid var(--line); background: var(--bg);
  scrollbar-width: thin;
}
.side-sec { display: grid; gap: 2px; padding: 6px 0 12px; }
.side-sec + .side-sec { border-top: 1px solid var(--line); padding-top: 12px; }
.side-h { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 4px 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side-link {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--text);
  padding: 8px 10px; border-radius: 10px; font-size: 14px; text-align: left;
}
.side-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.side-link svg { width: 18px; height: 18px; color: var(--muted); }
.side-link:hover { background: var(--surface-2); }
.side-link.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 600; }
.side-link.active svg, .side-link.active small { color: var(--accent); }
.side-empty { margin: 2px 10px; font-size: 13px; color: var(--muted); }
.side-tags, .chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 6px; }
.tag-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px;
  padding: 4px 10px; font-size: 13px;
}
.tag-chip small { color: var(--muted); margin-left: 2px; }
.tag-chip:hover { border-color: var(--accent); }
.tag-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.tag-chip.active small { color: inherit; }
.side-shade { position: fixed; inset: 0; z-index: 14; background: rgba(0,0,0,.4); }

@media (min-width: 1100px) {
  .nav-btn { display: none; }
  main { margin-left: var(--side); padding-left: 28px; max-width: none; }
  .side-shade { display: none; }
}
@media (max-width: 1099px) {
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); width: min(280px, 85vw); z-index: 30; top: 0; padding-top: calc(var(--top) + 8px); }
  body.nav-open .sidebar { transform: none; }
  .side-shade { z-index: 29; }
}

/* ---------- Kopfzeile der Ansicht ---------- */
.scope-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 18px 2px 4px; }
.scope-head h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; word-break: break-word; }
.scope-head h1 svg { width: 24px; height: 24px; color: var(--accent); }
.scope-head .crumb { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.link-btn { border: 0; background: none; color: var(--accent); padding: 0; font: inherit; cursor: pointer; }
.scope-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.scope-actions .btn { padding: 7px 14px; font-size: 14px; }
.scope-actions .btn svg { width: 16px; height: 16px; }
.btn.danger { color: #e5484d; }
.btn:disabled { opacity: .45; cursor: default; }
.scope-empty { padding: 40px 2px; max-width: 520px; }

/* ---------- Ordner-Übersicht ---------- */
.folder-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); padding: 14px 0; }
.folder-card { border: 0; background: transparent; color: var(--text); padding: 0; text-align: left; display: grid; gap: 4px; cursor: pointer; }
.folder-cover {
  aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center;
  color: var(--muted); transition: transform .15s, box-shadow .15s;
}
.folder-cover svg { width: 42px; height: 42px; }
.folder-cover img { width: 100%; height: 100%; object-fit: cover; }
.folder-card:hover .folder-cover { transform: translateY(-2px); box-shadow: var(--shadow); }
.folder-card strong { font-size: 15px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card span { font-size: 13px; color: var(--muted); }
.folder-empty { grid-column: 1 / -1; text-align: center; padding: 10vh 16px; color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.folder-empty svg { width: 48px; height: 48px; }
.folder-empty p { max-width: 420px; margin: 0 0 8px; }
@media (max-width: 760px) { .folder-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }

/* ---------- Kachel-Markierungen ---------- */
.tile .marks { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 4px; }
.tile .mark { width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.55); display: grid; place-items: center; }
.tile .mark svg { width: 13px; height: 13px; stroke: #fff; }
.tile .mark.fav svg { fill: #ff5a6e; stroke: #ff5a6e; }

/* ---------- Großansicht: Herz, Auswahl, Tags ---------- */
.icon-btn.light.on[data-lb="fav"] svg { fill: #ff5a6e; stroke: #ff5a6e; }
.icon-btn.light.on[data-lb="select"] { background: var(--accent); }
.lb-info .info-h { margin: 18px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #999; }
.lb-info .org .info-h:first-child { margin-top: 0; }
.lb-info .chips { padding: 0; }
.chip-x {
  display: inline-flex; align-items: center; gap: 4px; background: #2a2b30; color: #eee; border: 0;
  border-radius: 999px; padding: 4px 4px 4px 11px; font-size: 13px; font: inherit; font-size: 13px;
}
.chip-x svg { width: 14px; height: 14px; }
.chip-x button { border: 0; background: transparent; color: #aaa; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; padding: 0; cursor: pointer; }
.chip-x button:hover { background: rgba(255,255,255,.12); color: #fff; }
.chip-x.folder svg:first-child { width: 14px; height: 14px; margin-right: 2px; color: var(--accent); }
.lb-info .none { color: #777; font-size: 13px; }
.tag-add { display: flex; gap: 6px; margin-top: 10px; }
.tag-add input {
  flex: 1; min-width: 0; font: inherit; font-size: 14px; color: #fff; background: #222327; border: 1px solid #333;
  border-radius: 10px; padding: 8px 10px; outline: none;
}
.tag-add input:focus { border-color: var(--accent); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.small svg { width: 16px; height: 16px; }
.lb-info .btn.small { background: #222327; border-color: #333; color: #eee; }
.lb-info .chips.quick { margin-top: 8px; }
.lb-info .tag-chip { background: transparent; border-color: #3a3b40; color: #ccc; font-size: 12px; padding: 3px 9px; }
.lb-info .tag-chip:hover { border-color: var(--accent); color: #fff; }
.add-folder { margin-top: 10px; }
.lb-info { scrollbar-width: thin; }

/* ---------- Auswahl-Dialog ---------- */
.pick-new { display: flex; gap: 8px; margin-bottom: 12px; }
.pick-new input {
  flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; outline: none;
}
.pick-new input:focus { border-color: var(--accent); }
.pick-new .btn svg { width: 16px; height: 16px; }
.pick-list { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.pick-row {
  display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: var(--text);
  padding: 8px; border-radius: 12px; text-align: left; width: 100%;
}
.pick-row:hover { background: var(--surface-2); }
.pick-row.done { opacity: .6; }
.pick-cover { width: 44px; height: 44px; border-radius: 9px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.pick-cover img { width: 100%; height: 100%; object-fit: cover; }
.pick-name { flex: 1; min-width: 0; display: grid; }
.pick-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-name small { color: var(--muted); }
.pick-ok { font-size: 12px; color: #30a46c; white-space: nowrap; }
#pickBody .hint { margin: 8px 0 6px; }
#pickBody .chips { padding: 0; }
#pickBody .chip-x { background: var(--surface-2); color: var(--text); padding: 5px 8px 5px 11px; cursor: pointer; }
#pickBody .chip-x small { color: var(--muted); }
#pickBody .chip-x:hover { background: color-mix(in srgb, #e5484d 18%, var(--surface-2)); }
@media (max-width: 760px) {
  .selbar { gap: 0; padding: 0 8px; }
  .scope-head h1 { font-size: 22px; }
}
/* Buttons der Großansicht bleiben über dem Info-Bereich klickbar */
.lightbox .lb-top { z-index: 5; }
.selbar { overflow-x: auto; scrollbar-width: none; }
.selbar::-webkit-scrollbar { display: none; }
@media (max-width: 1099px) {
  .sidebar { padding-top: max(16px, env(safe-area-inset-top)); }
}
@media (max-width: 760px) {
  .topbar .brand { display: none; }
  .nav-btn { margin-left: -8px; }
  .sel-info strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
  .sel-info span { display: none; }
  .selbar [data-sel="all"] { display: none; }
  .selbar .icon-btn { flex: none; }
  .tile .check { width: 22px; height: 22px; left: 5px; top: 5px; }
  .tile.selected .check::after { left: 6px; top: 2px; }
}

/* ---------- Teilen: Metadaten-Option ---------- */
.check-row { display: flex; gap: 10px; align-items: flex-start; flex-basis: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin-top: 4px; color: var(--text) !important; }
.check-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check-row span { display: grid; gap: 2px; }
.check-row strong { font-size: 14px; }
.check-row small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.strip-badge { font-style: normal; color: #30a46c; font-weight: 600; }

/* ---------- Papierkorb / Tresor ---------- */
.scope-note { flex-basis: 100%; margin: 4px 0 0; font-size: 13px; color: var(--muted); max-width: 720px; }
.tile .trash-left {
  position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 600; color: #fff;
  background: rgba(0,0,0,.6); padding: 2px 7px; border-radius: 99px;
}
.icon-btn.light.danger { color: #ff6b6b; }
.vault-form { display: grid; gap: 12px; }
.vault-form .hint { margin: 0; }
.vault-field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.vault-field input {
  font: inherit; font-size: 15px; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; outline: none;
}
.vault-field input:focus { border-color: var(--accent); }
.vault-form .btn { justify-content: center; padding: 11px; }
.vault-form .btn svg { width: 16px; height: 16px; }
.vault-form .err:empty { display: none; }
.toast { display: flex; align-items: center; gap: 14px; }
#toastAction { border: 0; background: transparent; color: var(--accent); font-weight: 700; padding: 0; cursor: pointer; }
/* Korrekturen */
.scope-head h1 { flex: 1 1 auto; }
.scope-note { max-width: none; }
.share-new .check-row { display: flex; }
.share-new .check-row { flex: 1 1 100%; order: 3; }
.hint.warn { color: #e5484d; }

/* ---------- Eigene Rückfrage ---------- */
.ask-backdrop { z-index: 90; }
.ask-box { width: min(420px, 100%); display: grid; gap: 12px; padding: 20px; }
.ask-box > strong { font-size: 17px; line-height: 1.3; word-break: break-word; }
.ask-box p { margin: 0; color: var(--muted); font-size: 14px; white-space: pre-line; }
.ask-box input {
  font: inherit; font-size: 15px; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; outline: none;
}
.ask-box input:focus { border-color: var(--accent); }
.ask-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.btn.danger-fill { background: #e5484d; color: #fff; border-color: transparent; }

/* ---------- Sortieren & Filtern ---------- */
.sort-btn { position: relative; padding: 8px 12px; }
.sort-btn svg { width: 16px; height: 16px; }
.sort-btn.on { border-color: var(--accent); color: var(--accent); }
.sort-count {
  font-style: normal; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-grid; place-items: center; border-radius: 9px; background: var(--accent); color: var(--accent-text);
}
.filter-panel {
  position: absolute; right: 16px; top: calc(100% + 6px); z-index: 30; width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - var(--top) - 40px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.fp-title { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 14px; font-weight: 700; }
.fp-body { overflow-y: auto; padding: 0 12px; }
.filter-panel fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 8px 12px 12px; }
.filter-panel legend { padding: 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.fp-sorts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.fp-radio, .fp-check { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; padding: 2px 0; }
.fp-radio input, .fp-check input { accent-color: var(--accent); margin: 0; }
.fp-row, .fp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fp-grid { grid-template-columns: 1fr; margin-bottom: 6px; }
.fp-row label, .fp-grid label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.fp-grid label { grid-template-columns: 70px 1fr; align-items: center; }
.filter-panel input[type=date], .filter-panel select {
  font: inherit; font-size: 13px; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 7px; min-width: 0; width: 100%;
}
.fp-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fp-presets .btn { padding: 4px 9px; font-size: 12px; }
.fp-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.fp-foot span { flex: 1; font-size: 12px; color: var(--muted); }
.fp-foot .btn { padding: 6px 12px; font-size: 13px; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 2px 0; }
.af-sort { font-size: 12px; color: var(--muted); margin-right: 4px; }
.af-chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12px; cursor: pointer;
}
.af-chip b { font-weight: 700; font-size: 14px; line-height: 1; opacity: .8; }
.af-reset { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 12px; cursor: pointer; padding: 3px 4px; }
.month.flat .month-head { position: static; }
@media (max-width: 760px) {
  .sort-btn { order: 3; padding: 8px 10px; }
  .sort-label { display: none; }
  .filter-panel { position: fixed; left: 8px; right: 8px; top: 8px; width: auto; max-height: calc(100vh - 16px); }
  .fp-sorts { grid-template-columns: 1fr; }
}

/* ---------- Upload abbrechen ---------- */
#upList li { grid-template-columns: 1fr auto auto; align-items: center; }
.up-x {
  border: 0; background: transparent; color: var(--muted); width: 22px; height: 22px; padding: 0;
  font-size: 16px; line-height: 1; cursor: pointer; border-radius: 50%;
}
.up-x:hover { background: var(--surface-2); color: #e5484d; }
#upList li.done .up-x, #upList li.dup .up-x, #upList li.fail .up-x, #upList li.cancel .up-x { visibility: hidden; }
#upList li.cancel .s { color: var(--muted); }
#upList li.cancel .bar { display: none; }
#upList li.cancel .n { text-decoration: line-through; opacity: .7; }
.up-cancel { padding: 3px 8px; font-size: 12px; margin-right: 2px; }

/* ---------- LUT-Player ---------- */
.lutp { position: absolute; inset: 0; display: flex; flex-direction: column; background: #000; }
.lutp-canvas { flex: 1; min-height: 0; width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.lutp-video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lutp-load { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #aaa; font-size: 13px; }
.lutp-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  background: rgba(20, 20, 22, .92); color: #ddd; font-size: 12px; z-index: 2;
}
.lutp-btn { border: 1px solid #444; background: #26272b; color: #eee; min-width: 32px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.lutp-btn.wide { padding: 0 10px; }
.lutp-btn.on { background: #eee; color: #111; }
.lutp-btn.off { opacity: .45; }
.lutp-seek { flex: 1; min-width: 60px; accent-color: var(--accent); }
.lutp-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lutp-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; color: #9fb7d6; }
.lutp:fullscreen .lutp-canvas { cursor: default; }
@media (max-width: 760px) { .lutp-name, .lutp-time { display: none; } .lutp-bar { gap: 6px; } }
.icon-btn.light.on[data-lb="lut"] { color: #9fc0ea; }

/* ---------- LUT-Menü in der Großansicht ---------- */
.lut-menu {
  position: absolute; right: 12px; top: 52px; z-index: 6; width: min(320px, calc(100vw - 24px));
  background: #1f2023; color: #eee; border: 1px solid #3a3b40; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  padding: 8px; font-size: 13px;
}
.lm-title { font-weight: 700; padding: 4px 6px 8px; }
.lm-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px; border-radius: 6px; cursor: pointer; }
.lm-row:hover { background: #2c2d32; }
.lm-row input { margin-top: 2px; accent-color: var(--accent); }
.lm-row small { display: block; color: #999; font-size: 11px; }
.lm-empty { color: #999; font-size: 12px; padding: 4px 6px; margin: 0; }
.lm-foot { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 6px 2px; border-top: 1px solid #333; margin-top: 6px; }
.lm-foot .btn.small { background: #2c2d32; color: #eee; border-color: #444; }

/* ---------- LUTs verwalten ---------- */
.lut-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.lut-upload .btn { cursor: pointer; }
.lut-upload .hint { flex: 1; min-width: 180px; margin: 0; }
.lut-list { display: grid; gap: 6px; }
.lut-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.lut-name { flex: 1; min-width: 0; display: grid; }
.lut-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lut-name small { color: var(--muted); font-size: 11px; }
.lut-h { margin-top: 16px !important; font-weight: 700; }
.lut-cams { display: grid; gap: 8px; }
.lut-cams label { display: grid; grid-template-columns: 1fr 1.2fr; align-items: center; gap: 10px; font-size: 13px; }
.lut-cams select { font: inherit; font-size: 13px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; }
.lb-stage .msg small { display: block; color: #999; font-size: 12px; margin-top: 4px; line-height: 1.5; }
.lb-stage .msg .spinner { margin: 0 auto 4px; }
a.side-link { text-decoration: none; color: inherit; }
