/* Website-Admin – gleiche Optik wie die Galerie ("Fileserver um 2002") */
:root {
  --bg: #cfccc5; --surface: #efede8; --surface-2: #e2dfd8; --text: #1d1d1b; --muted: #67645d; --line: #9d9990;
  --accent: #2e5b88; --accent-text: #fff; --field: #fff; --sel: #2e5b88;
  --bev-hi: #fff; --bev-lo: #8a867d; --bev-dk: #4c4942; --title-a: #e9e7e1; --title-b: #cdc9c0;
  --ok: #2c7a3a; --warn: #a86a00; --err: #a3262a; --dither: rgba(0,0,0,.045);
  --ui: Tahoma, Verdana, "Segoe UI", Geneva, sans-serif;
  --mono: "Lucida Console", Monaco, "Andale Mono", "Courier New", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18191b; --surface: #26272a; --surface-2: #2f3034; --text: #e4e2dc; --muted: #97948c; --line: #4a4b50;
    --accent: #86a9d0; --accent-text: #0e1724; --field: #1b1c1f; --sel: #3d5f86;
    --bev-hi: #46474c; --bev-lo: #111214; --bev-dk: #000; --title-a: #393a3f; --title-b: #2a2b2f;
    --ok: #6fcf7f; --warn: #e6b450; --err: #f08a8a; --dither: rgba(255,255,255,.025);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: 13px/1.45 var(--ui); color: var(--text); background-color: var(--bg);
  background-image: linear-gradient(45deg, var(--dither) 25%, transparent 25%, transparent 75%, var(--dither) 75%),
    linear-gradient(45deg, var(--dither) 25%, transparent 25%, transparent 75%, var(--dither) 75%);
  background-size: 4px 4px; background-position: 0 0, 2px 2px;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
svg.px { image-rendering: pixelated; flex: none; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

.btn {
  font: 12px/1.2 var(--ui); color: var(--text); background: linear-gradient(var(--surface), var(--surface-2));
  border: 1px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi); box-shadow: 1px 1px 0 var(--bev-dk);
  padding: 5px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface); }
.btn:active { border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); box-shadow: inset 1px 1px 0 var(--bev-dk); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); color: var(--accent-text); font-weight: bold;
  border-color: color-mix(in srgb, var(--accent) 55%, #fff) var(--bev-dk) var(--bev-dk) color-mix(in srgb, var(--accent) 55%, #fff); }
.btn.danger { color: var(--err); }
.btn.small { padding: 2px 7px; font-size: 11px; }
.btn.on { border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); box-shadow: inset 1px 1px 0 var(--bev-dk); background: var(--surface-2); font-weight: bold; }
input[type=text], input[type=url], input[type=date], input[type=password], input[type=search], select, textarea {
  background: var(--field); border: 1px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo);
  box-shadow: inset 1px 1px 0 var(--bev-dk); padding: 5px 7px; font-size: 13px; border-radius: 0; width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.5; }
input[type=color] { width: 44px; height: 28px; padding: 1px; border: 1px solid var(--bev-lo); background: var(--field); }
label.f { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
label.f > span { font-weight: bold; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .f { flex: 1 1 160px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }

/* Gerüst */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px;
  background: linear-gradient(var(--title-a), var(--title-b)); border-bottom: 1px solid var(--bev-dk);
  box-shadow: inset 0 1px 0 var(--bev-hi), inset 0 -1px 0 var(--bev-lo);
}
.brand { font: bold 13px var(--mono); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .logo { width: 22px; height: 22px; background: #ff7a45; border: 1px solid var(--bev-dk); display: inline-flex; align-items: center; justify-content: center; }
.brand em { font-style: normal; font-weight: normal; color: var(--muted); }
.top .spacer { flex: 1; }
.pub-state { font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.pub-state.dirty { color: var(--warn); }
.nav-toggle { display: none; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100% - 46px); }
.side {
  background: var(--surface); border-right: 1px solid var(--bev-dk); box-shadow: inset -1px 0 0 var(--bev-lo);
  padding: 10px 8px 20px; position: sticky; top: 46px; height: calc(100vh - 46px); overflow: auto;
}
.side-h { font: bold 10px var(--mono); letter-spacing: .08em; color: var(--muted); border-bottom: 1px dotted var(--line); padding: 0 4px 3px 6px; margin: 12px 0 4px; display: flex; align-items: center; justify-content: space-between; text-transform: uppercase; }
.side-h:first-child { margin-top: 0; }
.side a, .side button.link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 8px; font-size: 12px; color: var(--text); text-decoration: none; border: 0; background: none; cursor: pointer; text-align: left; }
.side a:hover, .side button.link:hover { background: var(--surface-2); }
.side a.active { background: var(--sel); color: #fff; }
.side a small { margin-left: auto; font: 10px var(--mono); opacity: .8; }
.side a .dim { opacity: .5; }
main { padding: 18px 22px 60px; min-width: 0; }
.win { background: var(--surface); border: 1px solid; border-color: var(--bev-hi) var(--bev-dk) var(--bev-dk) var(--bev-hi); box-shadow: 2px 2px 0 rgba(0,0,0,.18); margin-bottom: 16px; }
.win > h2, .win > header { margin: 0; display: flex; align-items: center; gap: 8px; padding: 5px 8px; font: bold 12px var(--ui);
  background: linear-gradient(90deg, var(--title-b), var(--title-a)); border-bottom: 1px solid var(--line); }
.win > header .grow { flex: 1; }
.win .body { padding: 12px 14px; }
h1.view { font: bold 20px var(--mono); margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.view-sub { color: var(--muted); margin: 0 0 16px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.empty { color: var(--muted); padding: 22px; text-align: center; font-style: italic; }
.hint { font-size: 11px; color: var(--muted); background: color-mix(in srgb, #ffffe1 70%, var(--surface)); border: 1px dashed var(--line); padding: 6px 9px; }
@media (prefers-color-scheme: dark) { .hint { background: #2b2a20; } }
.badge { font: 10px var(--mono); padding: 1px 5px; border: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.badge.draft { color: var(--warn); border-color: var(--warn); }
.badge.live { color: var(--ok); border-color: var(--ok); }
.badge.err { color: var(--err); border-color: var(--err); }

/* Tabellen-Listen */
.list { width: 100%; border-collapse: collapse; background: var(--field); border: 1px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); }
.list th { text-align: left; font: bold 11px var(--ui); padding: 4px 8px; background: linear-gradient(var(--surface), var(--surface-2)); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.list td { padding: 6px 8px; border-bottom: 1px dotted var(--line); vertical-align: middle; }
.list tr.click { cursor: pointer; }
.list tr.click:hover td { background: var(--sel); color: #fff; }
.list tr.click:hover .badge { color: #fff; border-color: #fff; }
.list .thumb { width: 54px; height: 40px; object-fit: cover; display: block; background: var(--surface-2); border: 1px solid var(--line); }
.list .num { font-family: var(--mono); color: var(--muted); white-space: nowrap; }

/* Einträge (Tabs) */
.entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.entry { background: var(--field); border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; position: relative; }
.entry:hover { outline: 2px solid var(--sel); }
.entry .cov { aspect-ratio: 1; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.entry.vid .cov { aspect-ratio: 16/10; }
.entry .cov img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entry .cov .n { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.7); color: #fff; font: 10px var(--mono); padding: 1px 5px; }
.entry .txt { padding: 6px 8px; font-size: 12px; min-width: 0; }
.entry .txt strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.entry .txt small { color: var(--muted); }
.entry .badges { position: absolute; left: 4px; top: 4px; display: flex; gap: 3px; }
.entry .badges .badge { background: var(--field); }
.entry .mv { position: absolute; right: 3px; top: 3px; display: none; gap: 2px; }
.entry:hover .mv { display: flex; }
.entry .mv button { padding: 0 5px; font-size: 11px; }
.entries.audio { grid-template-columns: 1fr; gap: 4px; }
.entries.audio .entry { flex-direction: row; align-items: center; }
.entries.audio .entry .cov { width: 52px; flex: none; }
.entries.audio .entry .badges { position: static; padding-right: 8px; }
.entries.audio .entry .mv { top: 50%; transform: translateY(-50%); right: 8px; }

/* Medien */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.mtile { background: var(--field); border: 1px solid var(--line); font-size: 11px; position: relative; cursor: pointer; }
.mtile.sel { outline: 3px solid var(--sel); outline-offset: -1px; }
.mtile .cov { aspect-ratio: 1; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.mtile .cov img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mtile .cap { padding: 3px 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mtile .kind { position: absolute; left: 3px; top: 3px; }
.mtile .st { position: absolute; inset: auto 0 0 0; background: rgba(0,0,0,.72); color: #fff; font: 10px var(--mono); padding: 2px 4px; text-align: center; }
.mtile .st.err { background: var(--err); }
.spin { display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.editor.nopreview { grid-template-columns: 1fr; }
.toolbar { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-bottom: 0; }
.toolbar .btn { padding: 3px 8px; }
.toolbar .sep { width: 1px; background: var(--line); margin: 0 3px; }
#body { min-height: 420px; font: 13px/1.6 var(--mono); }
.preview { position: sticky; top: 60px; height: calc(100vh - 80px); border: 1px solid var(--bev-dk); background: #fff; }
.preview iframe { width: 100%; height: 100%; border: 0; display: block; }
.cover-pick { display: flex; align-items: center; gap: 8px; }
.cover-pick img { width: 64px; height: 48px; object-fit: cover; border: 1px solid var(--line); }

/* Dialoge */
.dlg-bg { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { background: var(--surface); border: 1px solid; border-color: var(--bev-hi) var(--bev-dk) var(--bev-dk) var(--bev-hi); box-shadow: 4px 4px 0 rgba(0,0,0,.35);
  width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.dlg.wide { width: min(1100px, 100%); height: calc(100vh - 32px); }
.dlg > header { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 10px; font-weight: bold; background: linear-gradient(90deg, #0c1a5c, #2c56c7 70%, #ff7a45); color: #fff; }
.dlg > header .grow { flex: 1; }
.dlg > header .x { width: 20px; height: 18px; padding: 0; justify-content: center; font-weight: bold; color: #000; }
.dlg .body { padding: 14px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.dlg footer { display: flex; gap: 6px; justify-content: flex-end; padding: 8px 12px; border-top: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.dlg footer .grow { flex: 1; }

/* Galerie-Auswahl */
.gp-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.gp-bar input[type=search] { flex: 1 1 200px; width: auto; }
.gp-bar select { width: auto; }
.gp-grid { flex: 1; overflow: auto; border: 1px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); background: var(--field); padding: 8px; min-height: 200px; }
.gp-month { font: bold 11px var(--mono); color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .06em; }
.gp-month:first-child { margin-top: 0; }
.gp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; }
.gp-tile { position: relative; aspect-ratio: 1; background: var(--surface-2); cursor: pointer; overflow: hidden; border: 0; padding: 0; }
.gp-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gp-tile .dur { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.7); color: #fff; font: 10px var(--mono); padding: 0 4px; }
.gp-tile.sel { outline: 3px solid var(--sel); outline-offset: -3px; }
.gp-tile.sel::after { content: '✓'; position: absolute; left: 4px; top: 4px; width: 18px; height: 18px; background: var(--sel); color: #fff; font: bold 12px/18px var(--ui); text-align: center; }
.gp-tile.used::before { content: 'auf Website'; position: absolute; left: 0; right: 0; top: 0; background: rgba(0,0,0,.6); color: #fff; font: 9px var(--mono); padding: 1px 3px; z-index: 1; }

/* Upload-Liste */
.uploads { position: fixed; right: 12px; bottom: 12px; z-index: 90; width: 320px; background: var(--surface); border: 1px solid var(--bev-dk); box-shadow: 3px 3px 0 rgba(0,0,0,.3); }
.uploads header { padding: 5px 8px; font-weight: bold; background: linear-gradient(90deg, var(--title-b), var(--title-a)); display: flex; align-items: center; }
.uploads header span { flex: 1; }
.uploads ul { list-style: none; margin: 0; padding: 6px 8px; max-height: 220px; overflow: auto; font-size: 11px; }
.uploads li { padding: 3px 0; }
.uploads .bar { height: 8px; background: var(--field); border: 1px solid var(--line); margin-top: 2px; }
.uploads .bar i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 8px); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 200; background: #111; color: #fff; padding: 8px 14px; border: 1px solid #000; box-shadow: 3px 3px 0 rgba(0,0,0,.3); font-size: 12px; max-width: calc(100% - 32px); }
.toast.err { background: var(--err); }

/* Einstellungen */
.rows { display: flex; flex-direction: column; gap: 6px; }
.rowline { display: flex; gap: 6px; align-items: center; }
.rowline > input, .rowline > select { flex: 1; }
.rowline .btn { flex: none; }
.gear-box { border: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.icon-row { display: flex; align-items: center; gap: 8px; padding: 3px 6px; background: var(--field); border: 1px solid var(--line); }
.icon-row input[type=text] { flex: 1; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.icon-pick button { padding: 4px; border: 1px solid transparent; background: none; cursor: pointer; }
.icon-pick button.on { border-color: var(--sel); background: var(--surface-2); }
.urls { font-family: var(--mono); font-size: 12px; }
.urls a { word-break: break-all; }
.stat { display: inline-flex; flex-direction: column; padding: 6px 12px; border: 1px solid var(--line); background: var(--field); min-width: 110px; }
.stat b { font: bold 18px var(--mono); }
.stat span { font-size: 11px; color: var(--muted); }

/* Login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login form { width: min(340px, 100%); display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; }
  .preview { position: static; height: 70vh; }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; top: 46px; left: 0; bottom: 0; width: 240px; z-index: 30; transform: translateX(-100%); transition: transform .15s; height: auto; }
  body.nav-open .side { transform: none; box-shadow: 4px 0 0 rgba(0,0,0,.25); }
  main { padding: 14px 12px 60px; }
  .top .hide-s, .pub-state { display: none; }
  .top { gap: 6px; padding: 0 8px; }
  #viewSite { padding: 2px 6px; }
  .brand em { display: none; }
}
