:root {
  --paper: #f4f1ea; --card: #fff; --ink: #1f2a22; --muted: #6a7064; --line: #e3ddd0;
  --forest: #2f5d3a; --forest-dark: #1d3b25; --sun: #e9a23b; --flame: #c8502d;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 400 1rem/1.55 "Source Sans 3", system-ui, sans-serif; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--forest); }
h1, h2 { font-family: "Fraunces", Georgia, serif; font-weight: 600; line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 8px 0 4px; }
.muted { color: var(--muted); }
code { background: #f1ede3; padding: 1px 5px; border-radius: 4px; font-size: .88em; }

/* Layout */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--forest-dark); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 4px 8px 22px; }
.side-brand span { font: 700 1.2rem "Fraunces", serif; line-height: 1.1; }
.side-brand small { display: block; font: 600 .72rem "Source Sans 3", sans-serif; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: rgba(255,255,255,.82); text-decoration: none; font-weight: 600; }
.side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side nav a.on { background: rgba(233,162,59,.18); color: #fff; box-shadow: inset 3px 0 0 var(--sun); }
.badge { margin-left: auto; background: var(--sun); color: var(--ink); font-size: .75rem; border-radius: 999px; padding: 1px 8px; }
.side-foot { margin-top: auto; display: grid; gap: 4px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 14px; }
.side-foot a, .side-foot button { color: rgba(255,255,255,.75); text-decoration: none; padding: 8px 12px; border-radius: 8px; font: 600 .95rem "Source Sans 3", sans-serif; background: none; border: 0; text-align: left; cursor: pointer; width: 100%; }
.side-foot a:hover, .side-foot button:hover, .side-foot a.on { background: rgba(255,255,255,.07); color: #fff; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 22px 32px 6px; }
.topbar h1 { margin: 0; font-size: 1.8rem; }
.menu-btn { display: none; font-size: 1.4rem; background: none; border: 0; cursor: pointer; padding: 6px 10px; }
.inner { padding: 14px 32px 60px; max-width: 1100px; }

@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; z-index: 40; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .menu-btn { display: block; }
  .topbar { padding: 16px 16px 4px; }
  .topbar h1 { font-size: 1.4rem; }
  .inner { padding: 12px 16px 48px; }
}

/* Bausteine */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--forest); background: var(--forest); color: #fff; font: 700 .95rem "Source Sans 3", sans-serif; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--forest-dark); border-color: var(--forest-dark); color: #fff; }
.btn-light { background: #fff; color: var(--forest); }
.btn-light:hover { background: #eef3ea; color: var(--forest); }
.btn-danger { background: #fff; color: var(--flame); border-color: #ecc3b4; }
.btn-danger:hover { background: var(--flame); color: #fff; border-color: var(--flame); }
.btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 1rem; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: #e3eedb; color: #234a2c; border: 1px solid #b9d3a9; }
.flash-error { background: #f8e1d8; color: #7a2a12; border: 1px solid #ecb7a3; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #efebe1; font-size: .8rem; font-weight: 700; color: var(--muted); }
.tag-ok { background: #e3eedb; color: #2d6a3a; }
.tag-sun { background: #fbe9c8; color: #8a5a10; }
.help { font-size: .88rem; color: var(--muted); margin: -6px 0 0; }

/* Übersicht */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; text-decoration: none; color: var(--ink); }
.stat b { display: block; font: 600 2.1rem/1 "Fraunces", serif; color: var(--forest); margin-bottom: 4px; }
.stat span { color: var(--muted); font-weight: 600; }
.stat.hot { border-color: var(--sun); background: #fffaf0; }
.stat.hot b { color: var(--flame); }
.quick { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border: 0; }
.date { display: inline-block; min-width: 92px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--flame); margin-right: 8px; vertical-align: 1px; }

/* Tabellen */
.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 18px; border-bottom: 1px solid var(--line); }
td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf8f3; }
td a { text-decoration: none; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.dim { opacity: .55; }
.unread td { background: #fffaf0; }
.clip { color: var(--muted); }

/* Karten */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { display: flex; align-items: center; gap: 14px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--forest); }
.card img, .card .avatar { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; flex: none; }
.card .avatar { display: grid; place-items: center; background: #e6eddf; color: var(--forest); font: 600 1.4rem "Fraunces", serif; }
.card strong, .card span { display: block; }

/* Formulare */
.form { display: grid; gap: 16px; }
.form.narrow { max-width: 460px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form .row { grid-template-columns: 1fr; } }
label { display: grid; gap: 6px; font-weight: 600; font-size: .93rem; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; font: 400 1rem "Source Sans 3", sans-serif; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 4px rgba(47,93,58,.14); }
input[type=file] { font: inherit; font-weight: 400; padding: 8px; border: 1.5px dashed var(--line); border-radius: 9px; background: #fcfbf7; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check.inline { display: inline-flex; margin-left: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--forest); }
.checks { display: flex; flex-wrap: wrap; gap: 20px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.danger-zone { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.current-img { display: flex; align-items: center; gap: 16px; }
.current-img img { width: 140px; border-radius: 8px; }
.current-img.wide img { width: 280px; }
.dropzone { border: 2px dashed #cfd9c6; background: #f7faf4; border-radius: var(--radius); padding: 18px; }
.dropzone input { border: 0; background: none; padding: 6px 0 0; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.img-item { background: #faf8f3; border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 6px; }
.img-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; }
.img-item input { padding: 6px 8px; font-size: .9rem; }
.link-danger { background: none; border: 0; color: var(--flame); font: 600 .85rem "Source Sans 3", sans-serif; cursor: pointer; text-align: left; padding: 2px 0; }
.meta-list { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; margin: 0 0 18px; }
.meta-list dt { color: var(--muted); font-weight: 600; }
.meta-list dd { margin: 0; }
.message-body { background: #faf8f3; border-radius: 10px; padding: 18px; margin-bottom: 18px; white-space: normal; }

/* Login */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: url("../img/landschaft.svg") center bottom / cover no-repeat, var(--paper);
}
.login-card { width: min(400px, 100%); background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 18px; padding: 34px 30px; box-shadow: 0 20px 50px -20px rgba(31,42,34,.35); text-align: center; }
.login-card h1 { margin: 14px 0 0; font-size: 1.7rem; }
.login-card img { margin: 0 auto; }
.login-card .muted { margin: 2px 0 20px; }
.login-card .stack { display: grid; gap: 14px; text-align: left; }
.login-card .back { display: inline-block; margin-top: 18px; color: var(--muted); text-decoration: none; font-size: .92rem; }
.side-logo { height: 38px; width: auto; max-width: 90px; object-fit: contain; }
.login-logo { height: 64px; width: auto; max-width: 180px; object-fit: contain; }

/* Bilder und Uploader */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 16px; text-decoration: none; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--forest); border-color: var(--sun); }
.uploader { margin-top: 12px; }
.drop { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 30px 20px; border: 2px dashed #c7d4bc; background: #f7faf4; border-radius: var(--radius); cursor: pointer; color: var(--forest); transition: .15s; }
.drop:hover, .drop.over { border-color: var(--forest); background: #eef4e8; }
.drop.busy { opacity: .6; pointer-events: none; }
.drop strong { font-size: 1.05rem; }
.drop .muted { font-weight: 400; font-size: .9rem; max-width: 52ch; }
.up-status { margin-top: 14px; }
.up-bar { height: 8px; background: #ebe6da; border-radius: 99px; overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--forest); transition: width .2s; }
.up-text { margin: 8px 0; }
.up-text .err { color: var(--flame); font-size: .9rem; }
.up-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.up-thumbs img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }
.media-list { display: grid; gap: 10px; margin-bottom: 8px; }
.media-row { display: flex; align-items: center; gap: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fcfbf7; }
.media-row img { width: 150px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; flex: none; }
.media-row .grow { flex: 1; display: grid; gap: 6px; min-width: 0; }
.row-actions { display: flex; gap: 6px; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-size: 1rem; color: var(--ink); }
.icon-btn:hover:not(:disabled) { border-color: var(--forest); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.danger { color: var(--flame); }
.icon-btn.danger:hover { border-color: var(--flame); }
@media (max-width: 640px) { .media-row { flex-wrap: wrap; } .media-row img { width: 100%; } }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 8px; }
.lib-actions { display: flex; justify-content: space-between; }
.link-btn { background: none; border: 0; color: var(--forest); font: 700 .85rem "Source Sans 3", sans-serif; cursor: pointer; padding: 2px 0; }
.logo-preview { display: flex; gap: 10px; margin-bottom: 12px; }
.logo-preview img { height: 70px; width: auto; max-width: 45%; object-fit: contain; padding: 10px; border-radius: 10px; background: #f6f1e7; border: 1px solid var(--line); }
.logo-preview img.dark { background: var(--forest-dark); }
.hint { background: #fffaf0; border-color: #f0dcb4; }
.media-row .avatar.link-avatar { width: 150px; aspect-ratio: 16/9; height: auto; border-radius: 8px; flex: none; display: grid; place-items: center; background: #e6eddf; color: var(--forest); font: 600 1.6rem "Fraunces", serif; }
.small { font-size: .88rem; }
.flyer-field { display: grid; gap: 10px; }
.current-img img.flyer-prev { width: 110px; aspect-ratio: 3/4; object-fit: cover; border: 1px solid var(--line); }
.pdf-chip { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 10px; background: #f8e7df; color: var(--flame); font-weight: 700; text-decoration: none; }
.cover-tag { position: absolute; }
