:root { --teal: #ad3f26; --teal-dark: #7f2a16; --teal-soft: #f7e2db; --sun: #e0895c; --coral: #5e2414; --ink: #2a211d; --ink-2: #5a6668; --line: #e4e0d8; --bg: #f5f3ee; }
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Figtree', system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--teal); }
h1 { font-size: 1.7rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
.muted { color: var(--ink-2); margin: 0; }
.small { font-size: .9rem; }
code { background: var(--teal-soft); padding: 1px 6px; border-radius: 5px; font-size: .88em; }

body.with-side { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #d8cdc7; padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; padding: 0 8px 18px; }
.side-brand img { width: 36px; }
.side-brand span { display: flex; flex-direction: column; line-height: 1.2; }
.side-brand small { color: var(--sun); font-size: .78rem; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: #ece2dc; text-decoration: none; padding: 8px 12px; border-radius: 10px; }
.side nav a:hover { background: rgba(255,255,255,.07); }
.side nav a.on { background: var(--teal); color: #fff; }
.side-label { text-transform: uppercase; font-size: .7rem; letter-spacing: .12em; color: #a89a92; margin: 16px 12px 4px; }
.side-foot { margin-top: auto; padding: 16px 8px 0; display: grid; gap: 8px; border-top: 1px solid rgba(255,255,255,.1); }
.side-foot a { color: #fff; }
.side-foot button { background: none; border: 1px solid rgba(255,255,255,.2); color: #d8cdc7; border-radius: 10px; padding: 8px; cursor: pointer; font: inherit; width: 100%; }

.main { padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: 1200px; width: 100%; }
body.bare .main { margin: 0 auto; max-width: 440px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.crumb { margin: 0 0 6px; font-size: .9rem; }
.crumb a { text-decoration: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; border-radius: 999px; background: var(--teal); color: #fff; border: 2px solid var(--teal); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--teal); }
.btn.ghost:hover { background: var(--teal-soft); color: var(--teal-dark); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--teal); cursor: pointer; text-decoration: underline; }
.linkbtn.danger { color: #b53b22; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600; }
.flash-ok { background: #e1f4e8; color: #1d6b3a; }
.flash-err { background: #fde5df; color: #9b3b26; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.quick-card { border-radius: 16px; padding: 18px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); background: #fff; border-top: 5px solid var(--teal); transition: transform .15s; }
.quick-card:hover { transform: translateY(-2px); }
.quick-card.q2 { border-top-color: var(--sun); }
.quick-card.q3 { border-top-color: var(--coral); }
.quick-card.q4 { border-top-color: #e0895c; }
.quick-card strong { font-size: 1.05rem; }
.quick-card span { color: var(--ink-2); font-size: .9rem; }
.counts, .recent, .userlist { list-style: none; margin: 0; padding: 0; }
.counts a { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.counts b { background: var(--teal-soft); color: var(--teal-dark); border-radius: 999px; padding: 0 10px; }
.recent li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.recent small { color: var(--ink-2); }
.tips ul { margin: 0; padding-left: 18px; }
.tips li { margin-bottom: 6px; }

.table-panel { padding: 0; overflow: hidden; }
table.table { width: 100%; border-collapse: collapse; }
table.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); padding: 14px 18px; background: #faf9f6; border-bottom: 1px solid var(--line); }
table.table td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table tr:last-child td { border-bottom: 0; }
table.table tr:hover td { background: #fcfbf8; }
table.table td a { text-decoration: none; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { margin-left: 14px; display: inline; }
.row-actions form { display: inline; }
.empty { padding: 28px; margin: 0; }

.edit-form { display: grid; gap: 20px; max-width: 900px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input[type=text], .field input[type=date], .field input[type=number], .field input[type=password], .field textarea, .field select, .stack input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
.field input:focus, .field textarea:focus, .field select:focus, .stack input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.field input[type=date], .field input[type=number] { max-width: 220px; }
.field select { max-width: 320px; }
.help { display: block; color: var(--ink-2); margin-top: 5px; font-size: .86rem; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check.small { font-weight: 400; font-size: .9rem; }
.upload { border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.upload-current { display: flex; align-items: center; gap: 16px; }
.upload-current img { max-height: 110px; max-width: 200px; border-radius: 10px; object-fit: cover; }
.upload details summary { cursor: pointer; color: var(--ink-2); font-size: .88rem; }
.upload details input, .upload details textarea { margin-top: 8px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; }
.form-actions { display: flex; gap: 10px; position: sticky; bottom: 0; background: #fff; padding: 14px 0 4px; border-top: 1px solid var(--line); }
.EasyMDEContainer .CodeMirror { border-radius: 0 0 10px 10px; border-color: var(--line); font-family: inherit; }
.editor-toolbar { border-radius: 10px 10px 0 0; border-color: var(--line); }

.auth { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 32px; margin-top: 10vh; }
.auth-logo { width: 52px; margin-bottom: 14px; }
.stack { display: grid; gap: 14px; margin-top: 18px; }
.stack label { display: grid; gap: 6px; font-weight: 600; }

.upload-panel { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.media-item { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: grid; gap: 8px; }
.media-thumb { aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--teal-soft); display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--teal); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-item input { width: 100%; font-size: .8rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.media-meta { display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); }
.userlist li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 860px) {
  body.with-side { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side-label { display: none; }
  .grid2, .quick { grid-template-columns: 1fr 1fr; }
  table.table thead { display: none; }
  table.table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.table td { display: block; border: 0; padding: 4px 16px; }
  .row-actions { text-align: left; }
  .row-actions > *:first-child { margin-left: 0; }
}
@media (max-width: 560px) { .grid2, .quick { grid-template-columns: 1fr; } }
.editor-preview table, .editor-preview-side table { border-collapse: collapse; margin: 1em 0; }
.editor-preview th, .editor-preview td, .editor-preview-side th, .editor-preview-side td { border: 1px solid var(--line); padding: 6px 10px; }
.editor-preview th, .editor-preview-side th { background: var(--teal-soft); }

/* Ankreuz-Gruppe */
.check-group { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 10px 0 2px; }
.check-group .check { font-weight: 500; }

/* Galerie-Verwaltung */
.g-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.g-tile { position: relative; display: block; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #faf9f6; cursor: pointer; font-weight: 400 !important; margin: 0 !important; }
.g-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.g-doc { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; text-align: center; background: var(--teal-soft); }
.g-doc b { background: var(--teal); color: #fff; border-radius: 6px; padding: 3px 8px; font-size: .8rem; }
.g-doc small { font-size: .74rem; line-height: 1.2; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.g-remove { display: flex; align-items: center; gap: 5px; font-size: .78rem; padding: 6px 8px; background: #fff; border-top: 1px solid var(--line); }
.g-tile:has(input:checked) { outline: 3px solid #c0392b; opacity: .6; }

/* Vorschau im Editor wie auf der Website */
.editor-preview .prose, .editor-preview-side .prose { font-size: 1rem; line-height: 1.6; }
.prose .align-left { text-align: left; } .prose .align-center { text-align: center; } .prose .align-right { text-align: right; } .prose .align-justify { text-align: justify; hyphens: auto; }
.prose .align-center img { margin-inline: auto; }
.prose img { max-width: 100%; border-radius: 10px; }
.doc-chip { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-decoration: none; color: var(--ink); margin: 2px 0; }
.doc-chip-type { background: var(--teal); color: #fff; font-size: .72rem; font-weight: 800; border-radius: 6px; padding: 3px 7px; }
.doc-chip-dl { color: var(--teal); font-weight: 800; }
