:root {
    --bg: #f4f5f7;
    --card: #fff;
    --text: #1f2933;
    --muted: #6b7280;
    --line: #e2e5ea;
    --accent: #2f5d8a;
    --accent-dark: #244a6e;
    --ok: #1f7a4d;
    --warn: #9a6700;
    --danger: #b42318;
    --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }

/* Kopfzeile */
.topbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
    padding: .75rem 1.25rem; background: #1f2933; color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; }
.nav { display: flex; gap: 1rem; flex: 1; }
.nav a { opacity: .85; }
.nav a:hover { opacity: 1; text-decoration: underline; }
.who { display: flex; gap: .6rem; align-items: center; font-size: .9rem; }
.who a { opacity: .85; }
.topbar .badge { background: rgba(255,255,255,.15); color: #fff; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

/* Bausteine */
.panel {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem; margin-bottom: 1.25rem;
}
.panel-danger { border-color: #f1c4bf; }
.narrow { max-width: 480px; margin: 3rem auto; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: .88rem; }
.empty { color: var(--muted); }

.btn {
    display: inline-block; border: 0; border-radius: 6px; cursor: pointer;
    background: var(--accent); color: #fff; padding: .55rem 1rem;
    font: inherit; font-weight: 600; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-light { background: #e8edf3; color: var(--text); }
.btn-light:hover { background: #dbe2ea; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f1b13; }
.btn-small { padding: .35rem .7rem; font-size: .85rem; }
.btn-large { padding: .8rem 1.4rem; font-size: 1.05rem; }

.badge {
    display: inline-block; padding: .1rem .5rem; border-radius: 999px;
    font-size: .75rem; font-weight: 600; background: #e8edf3; color: var(--text);
}
.badge-public { background: #e3f4ea; color: var(--ok); }
.badge-internal { background: #e8edf3; color: var(--accent-dark); }
.badge-expired { background: #fdecea; color: var(--danger); }

.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash-ok { background: #e3f4ea; color: var(--ok); }
.flash-error { background: #fdecea; color: var(--danger); }
.flash-warn { background: #fff4d6; color: var(--warn); }

/* Formulare */
label { display: block; margin-bottom: .9rem; font-weight: 600; font-size: .92rem; }
label input[type=text], label input[type=date], label input[type=file] {
    display: block; width: 100%; margin-top: .3rem; font: inherit; font-weight: 400;
}
input[type=text], input[type=date], input[type=search], select {
    padding: .5rem .6rem; border: 1px solid #cfd5dc; border-radius: 6px; font: inherit; background: #fff;
}
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
label.check input { margin: 0; }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.toolbar h1 { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters label.check { margin: 0; }

.linkbox { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.linkbox input { flex: 1; min-width: 240px; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }

.progress { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; }
.progress progress { flex: 1; height: 1rem; }
.progress-text { font-size: .85rem; color: var(--muted); min-width: 12rem; }
.upload-error { margin-top: 1rem; }
[hidden] { display: none !important; }

/* Übersicht */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card.is-expired { opacity: .6; }
.thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 10; background: #e9ecf0; text-decoration: none; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-label { font-size: 2rem; color: #7b8794; }
.thumb-video { color: var(--accent); }
.thumb-html { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; }
.card-body { padding: .8rem .9rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card-body h2 { font-size: 1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; flex-wrap: wrap; gap: .35rem; }
.small { font-size: .8rem; color: var(--muted); }
.card .actions { margin-top: auto; padding-top: .4rem; }

/* Detail / Info */
.info { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; font-size: .92rem; }
.info dt { color: var(--muted); }
.info dd { margin: 0; word-break: break-word; }

/* Ansicht */
.viewer { max-width: 1100px; margin: 0 auto; }
.media-box { background: #111; border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; display: flex; justify-content: center; }
.media-box img { max-width: 100%; max-height: 80vh; display: block; }
.media-box video { width: 100%; max-height: 80vh; display: block; background: #000; }

/* Tabelle */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
.table th { background: #f8f9fb; font-weight: 600; }
.table tr.is-blocked td { color: var(--muted); text-decoration: line-through; }
.table tr.is-blocked td:last-child { text-decoration: none; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
.inline-form label.check { margin: 0; }

@media (max-width: 640px) {
    .nav { order: 3; width: 100%; }
    .who-name { display: none; }
}

/* Tabs */
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; font: inherit; font-weight: 600; padding: .6rem 1rem; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* Album-Karten */
.badge-album { background: #efe7fb; color: #5b3a9a; }
.thumb { position: relative; }
.album-count { position: absolute; right: .5rem; bottom: .5rem; background: rgba(0,0,0,.65); color: #fff; font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; }

/* Galerie */
.album-actions { margin-bottom: 1rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; }
.gallery-item { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; background: #e9ecf0; border-radius: 6px; overflow: hidden; text-decoration: none; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.gallery-item:hover img { transform: scale(1.04); }

/* Lightbox */
body.lb-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.lb-img { max-width: calc(100vw - 7rem); max-height: calc(100vh - 6rem); object-fit: contain; user-select: none; }
.lb-btn { position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; font-size: 2rem; line-height: 1; border-radius: 6px; padding: .4rem .8rem; }
.lb-btn:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 1rem; right: 1rem; font-size: 1.4rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lb-bar { position: absolute; bottom: 1rem; left: 0; right: 0; display: flex; justify-content: center; gap: 1.5rem; color: #ddd; font-size: .9rem; }
.lb-bar a { color: #fff; }
@media (max-width: 640px) {
    .lb-img { max-width: 100vw; max-height: calc(100vh - 5rem); }
    .lb-prev, .lb-next { background: rgba(0,0,0,.35); }
}

/* Album bearbeiten */
.photo-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.photo-tile { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.photo-thumb { position: relative; aspect-ratio: 1 / 1; background: #e9ecf0; display: flex; align-items: center; justify-content: center; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-pos { position: absolute; left: .35rem; top: .35rem; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; padding: .05rem .4rem; border-radius: 999px; }
.photo-name { font-size: .75rem; color: var(--muted); padding: .3rem .4rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-buttons { display: flex; gap: .25rem; padding: .35rem .4rem .45rem; }
.photo-buttons form { margin: 0; }
.photo-buttons .btn { padding: .2rem .5rem; }
.photo-tile:target { outline: 3px solid var(--accent); }
