/* Admin: schlicht und funktional */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: #f1f2f4; color: #1d1f24; }
a { color: #2747a8; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .25rem; }
.main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head h1 { margin: 0; }
.head__actions { display: flex; gap: .5rem; }
.box { background: #fff; border: 1px solid #dcdfe4; border-radius: 8px; padding: 1.25rem; margin-bottom: 1.25rem; }
.narrow { max-width: 560px; }
.login { max-width: 360px; margin: 10vh auto; }
.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .75rem; }
label.color { display: flex; align-items: center; gap: .6rem; font-weight: 400; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; font: inherit; font-weight: 400; padding: .5rem .6rem; border: 1px solid #c4c8cf; border-radius: 6px; background: #fff; }
input[type=checkbox] { width: auto; display: inline; margin: 0; }
input[type=color] { width: 3rem; height: 2.25rem; padding: .15rem; margin: 0; }
input.small { width: 6rem; margin: 0; }
textarea.code, pre { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
pre { background: #f5f6f8; padding: .5rem; overflow-x: auto; white-space: pre-wrap; }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: .55rem 1.1rem; border-radius: 6px; border: 1px solid #2747a8; background: #2747a8; color: #fff; cursor: pointer; text-decoration: none; }
.btn--quiet { background: #fff; color: #2747a8; }
.btn--small { padding: .3rem .7rem; font-size: .88rem; }
.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #dcdfe4; margin-bottom: 1.25rem; }
.table th, .table td { padding: .55rem .75rem; border-bottom: 1px solid #eceef1; text-align: left; vertical-align: middle; }
.table th { background: #f7f8fa; font-size: .85rem; }
.right { text-align: right !important; }
.status { padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; background: #eceef1; }
.status--live, .status--bezahlt, .status--versendet { background: #dcf3e3; color: #145c2b; }
.status--draft, .status--neu { background: #fff2cc; color: #6b4e00; }
.status--zahlung_pruefen { background: #fde0dc; color: #8a1c12; } /* PayPal prüft noch oder Betrag weicht ab: im PayPal-Konto nachsehen */
.status--offline, .status--storniert { background: #f6dcdc; color: #7a1d1d; }
.error { color: #b3261e; font-weight: 600; margin: .3rem 0 0; }
.flash { background: #dcf3e3; border: 1px solid #a9dcb9; padding: .6rem 1rem; border-radius: 6px; }
.hint { color: #5b616b; font-size: .9rem; }
.sticky-save { position: sticky; bottom: 0; background: #f1f2f4; padding: .75rem 0; border-top: 1px solid #dcdfe4; }
.inline { display: flex; gap: .5rem; align-items: center; }
.inline select { width: auto; margin: 0; }
.pre { white-space: pre-line; margin: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.dl dd { margin: 0; }
details summary { cursor: pointer; margin-bottom: .5rem; }
.checks { border: 0; padding: 0; margin: 0 0 .75rem; }
.checks legend { font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.inline-check { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin-bottom: .4rem; }
input[readonly] { background: #f5f6f8; color: #5b616b; }
.nowrap { white-space: nowrap; }
.modules { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.module { background: #fff; border: 1px solid #dcdfe4; border-left: 4px solid #2747a8; border-radius: 8px; }
.module__head { display: flex; align-items: center; gap: .75rem; padding: .6rem .9rem; border-bottom: 1px solid #eceef1; background: #f7f8fa; border-radius: 8px 8px 0 0; }
.module__title { flex: 1; }
.module__tools { display: flex; gap: .35rem; }
.module__body { padding: .9rem; margin: 0; }
.module .wide { grid-column: 1 / -1; }
.tool { font: inherit; padding: .25rem .6rem; border: 1px solid #c4c8cf; border-radius: 6px; background: #fff; cursor: pointer; }
.tool:disabled { opacity: .35; cursor: default; }
.tool--danger { color: #b3261e; border-color: #e3b5b2; }
.add-module { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.add-module label { margin: 0; }
.add-module select { width: auto; margin: 0; }
.prefix-input { display: flex; align-items: center; gap: .25rem; }
.prefix-input input { margin-top: 0; }
.btn--danger { background: #fff; color: #b3261e; border-color: #b3261e; }
.delete-form { margin-top: 1rem; }

/* ---------- Tablet und Handy ---------- */
.btn, .tool { min-height: 2.5rem; }
.btn--small, .tool { min-height: 2.25rem; }
@media (max-width: 900px) {
  .main { padding: 1rem; }
  /* breite Tabellen seitlich wischbar statt die Seite zu sprengen */
  .table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .table td:first-child, .table th:first-child { position: sticky; left: 0; background: inherit; }
  .table td { background: #fff; }
  .head__actions { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .cols { grid-template-columns: 1fr; }
  .box { padding: 1rem; }
  .add-module select { flex: 1; min-width: 0; }
  .login { margin: 4vh auto; }
  .sticky-save .btn { width: 100%; }
  input, select, textarea { font-size: 16px; } /* verhindert Zoom beim Antippen auf iPhones */
  pre { white-space: pre-wrap; word-break: break-all; }
}

/* Bausteine einklappen (praktisch auf dem Handy) */
.module__toggle { flex: 1; display: flex; align-items: center; gap: .5rem; background: none; border: 0; padding: .25rem 0; font: inherit; font-weight: 700; text-align: left; cursor: pointer; color: inherit; }
.module__toggle::before { content: "▾"; color: #5b616b; transition: transform .15s; }
.module.is-collapsed .module__toggle::before { transform: rotate(-90deg); }
.module.is-collapsed .module__body { display: none; }
.module.is-collapsed .module__head { border-bottom: 0; border-radius: 8px; }
.modules-tools { display: flex; gap: .5rem; justify-content: flex-end; margin: -.25rem 0 .5rem; }
@media (max-width: 640px) {
  .module__head { flex-wrap: nowrap; }
  .module__tools .tool--danger { padding-inline: .5rem; }
}
.lang-block { border: 1px solid #dcdfe4; border-radius: 8px; padding: .75rem 1rem; margin-bottom: .75rem; }
.lang-block summary { font-weight: 700; }
.lang-block[open] summary { margin-bottom: .75rem; }

.swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-right: .4rem; vertical-align: -1px; }
.inline-block { display: inline-block; }
label[hidden] { display: none; }
span[hidden], p[hidden] { display: none; }
.table--kv th { width: 16rem; font-weight: 600; vertical-align: top; }
.table--kv td code { white-space: pre-wrap; word-break: break-word; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.img-tile { margin: 0; background: #fff; border: 1px solid #e3e0dc; border-radius: 6px; padding: .5rem; text-align: center; }
.img-tile img { width: 100%; height: 200px; object-fit: contain; background: #f4f3f1; border-radius: 4px; }
.img-tile figcaption { font-size: .82rem; margin-top: .35rem; }
.prod-link { display: inline-flex; align-items: center; gap: .5rem; }
.prod-thumb { width: 28px; height: 40px; object-fit: contain; background: #f4f3f1; border-radius: 3px; }
.link-button.error { color: #b3261e; }
.error-box { border-left: 4px solid #b3261e; margin-bottom: 1.5rem; }
.muted-row td { color: #888; }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { text-decoration: underline; }
.img-ok { color: #2e7d32; font-weight: 700; }
.img-missing { display: inline-block; background: #fde7e5; color: #b3261e; border-radius: 4px; padding: 0 .4rem; font-size: .82rem; white-space: nowrap; }
.danger-zone { border: 1px solid #e3a49f; }
.danger-zone summary { cursor: pointer; color: #b3261e; }
.btn--danger { background: #b3261e; border-color: #b3261e; color: #fff; }
.upload-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .35rem; }
.upload-preview { display: block; max-width: 220px; max-height: 120px; object-fit: cover; margin-top: .4rem; border-radius: 4px; border: 1px solid #e3e0dc; }

/* ---------- Kopfleiste mit Gruppen (Klappmenüs), auf dem Handy als Menü ---------- */
.bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1.5rem; padding: .55rem 1.5rem; background: #1d1f24; color: #fff; }
.bar a { color: #fff; text-decoration: none; }
.bar__brand { font-weight: 700; white-space: nowrap; }
.bar__nav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.bar__link, .bar__group > summary { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .75rem; border-radius: 6px; cursor: pointer; white-space: nowrap; color: #e8e8ea; list-style: none; }
.bar__group > summary::-webkit-details-marker { display: none; }
.bar__group > summary::after { content: ""; width: .4rem; height: .4rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .7; }
.bar__group[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.bar__link:hover, .bar__group > summary:hover, .bar__group[open] > summary { background: rgba(255,255,255,.1); }
.bar__link.is-active, .bar__group.is-active > summary { background: rgba(255,255,255,.16); color: #fff; }
.bar__group { position: relative; }
.bar__menu { position: absolute; top: calc(100% + .35rem); left: 0; min-width: 12rem; padding: .35rem; background: #fff; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.bar__menu--right { left: auto; right: 0; }
.bar__menu a, .bar__logout { display: block; padding: .55rem .75rem; border-radius: 6px; color: #1d1f24; white-space: nowrap; text-align: left; background: none; border: 0; font: inherit; cursor: pointer; width: 100%; }
.bar__menu a:hover, .bar__logout:hover, .bar__menu a[aria-current] { background: #f0f1f4; }
.bar__menu a[aria-current] { font-weight: 600; }
.bar__menu form { margin: 0; }
.bar__group--user { margin-left: auto; }
.bar__group--user > summary { opacity: .85; }
.bar__badge { background: #c62828; color: #fff; border-radius: 999px; font-size: .72rem; padding: .05rem .4rem; line-height: 1.3; }
.bar__toggle { display: none; margin-left: auto; background: none; border: 0; padding: .5rem; cursor: pointer; }
.bar__toggle span { display: block; width: 22px; height: 2px; background: #fff; margin: 4px 0; transition: transform .2s, opacity .2s; }
.bar--open .bar__toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.bar--open .bar__toggle span:nth-child(2) { opacity: 0; }
.bar--open .bar__toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (max-width: 900px) {
  .bar { flex-wrap: wrap; gap: 0; padding: .5rem 1rem; }
  .bar__toggle { display: block; }
  .bar__nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: .5rem 0 .75rem; max-height: calc(100vh - 3.5rem); overflow-y: auto; }
  .bar--open .bar__nav { display: flex; }
  .bar__link, .bar__group > summary { display: flex; justify-content: space-between; padding: .75rem .5rem; }
  .bar__menu { position: static; box-shadow: none; background: rgba(255,255,255,.06); margin: 0 0 .25rem .75rem; }
  .bar__menu a, .bar__logout { color: #fff; padding: .65rem .75rem; }
  .bar__menu a:hover, .bar__logout:hover, .bar__menu a[aria-current] { background: rgba(255,255,255,.1); }
  .bar__group--user { margin-left: 0; border-top: 1px solid rgba(255,255,255,.15); margin-top: .25rem; padding-top: .25rem; }
}
/* Kopfleiste: alle Einträge exakt auf einer Linie (summary in details sonst mit Zeilen-Unterlänge versetzt) */
.bar__brand, .bar__link, .bar__group, .bar__group > summary { line-height: 1.25; }
.bar__group { display: block; }
.bar__link, .bar__group > summary { display: flex; align-items: center; height: 2.5rem; box-sizing: border-box; padding-block: 0; margin: 0; }
.bar__brand { display: flex; align-items: center; height: 2.5rem; }
@media (max-width: 900px) {
  .bar__group { display: block; height: auto; }
  .bar__link, .bar__group > summary { height: auto; padding-block: .75rem; }
}
.muted-row td { opacity: .55; }
.muted-row td:first-child { opacity: 1; }

/* Hilfe: aufklappbarer Kasten oben auf der Seite und Übersichtsseite */
.help-box { background: #eef4ff; border: 1px solid #cfdcf5; border-radius: 8px; padding: .6rem 1rem; margin: 0 0 1.25rem; }
.help-box > summary { cursor: pointer; font-weight: 600; color: #234a8f; margin: 0; list-style: none; }
.help-box > summary::-webkit-details-marker { display: none; }
.help-box > summary::before { content: "?"; display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; margin-right: .5rem; border-radius: 50%; background: #234a8f; color: #fff; font-size: .8rem; }
.help-box ol, .help-box ul, .help-topic ol, .help-topic ul { margin: .6rem 0 .4rem 1.2rem; padding: 0; line-height: 1.55; }
.help-box li, .help-topic li { margin-bottom: .25rem; }
.help-box__sub { margin: .6rem 0 0; font-weight: 600; font-size: .9rem; }
.help-box__more { margin: .5rem 0 0; font-size: .85rem; }
.help-index { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: 0 0 1.25rem; font-size: .9rem; }
.help-topic { margin-bottom: 1rem; scroll-margin-top: 5rem; }
.help-topic h2 { margin-top: 0; font-size: 1.1rem; }
.clone-form { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.clone-form select { max-width: 14rem; }

/* Text-Editor für Rechtstexte */
.rte { border: 1px solid #c9c9c4; border-radius: 6px; background: #fff; margin-top: .25rem; }
.rte__bar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .35rem; border-bottom: 1px solid #e3e3df; background: #f6f6f3; border-radius: 6px 6px 0 0; position: sticky; top: 3.5rem; z-index: 2; }
.rte__btn { min-width: 2.1rem; height: 2rem; padding: 0 .5rem; border: 1px solid #d6d6d1; border-radius: 4px; background: #fff; cursor: pointer; font: inherit; font-size: .85rem; line-height: 1; color: #222; }
.rte__btn:hover { background: #eef0f4; }
.rte__btn:disabled { opacity: .4; cursor: default; }
.rte__btn--source { margin-left: auto; font-family: Consolas, Menlo, monospace; }
.rte__btn.is-active { background: #234a8f; color: #fff; border-color: #234a8f; }
.rte__area { min-height: 12rem; max-height: 32rem; overflow-y: auto; padding: .75rem 1rem; outline: none; line-height: 1.55; }
.rte__area:focus { box-shadow: inset 0 0 0 2px #cfdcf5; }
.rte__area h2 { font-size: 1.15rem; margin: 1rem 0 .4rem; }
.rte__area h3 { font-size: 1rem; margin: .8rem 0 .3rem; }
.rte__area p { margin: 0 0 .6rem; }
.rte__area ul, .rte__area ol { margin: 0 0 .6rem 1.4rem; padding: 0; }
.rte__area a { color: #234a8f; text-decoration: underline; }
.rte__source { width: 100%; min-height: 12rem; border: 0; border-top: 1px solid #e3e3df; border-radius: 0 0 6px 6px; padding: .75rem; font-family: Consolas, Menlo, monospace; font-size: .85rem; }
.rte { font-weight: 400; }
.rte [hidden] { display: none !important; }
