/* Dashboard: ruhiges Werkzeug. Farbe kommt nur von den Flyern der Veranstaltungen. */
:root {
  --ink: #1d1c22;
  --ink-2: #5d5b66;
  --paper: #f5f5f7;
  --card: #ffffff;
  --rule: #dcdbe2;
  --uv: #3f2be0;
  --uv-soft: #ecebfd;
  --ok: #0a6b42;
  --ok-soft: #dcf3e8;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --warn-soft: #fff1cf;
  --warn: #7a5300;
  --r: 8px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 'Instrument Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
a { color: inherit; }
code { background: #ececf1; padding: .05em .35em; border-radius: 4px; font-size: .9em; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--uv); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; }
label:focus-within:has(.visually-hidden) { outline: 2px solid var(--uv); outline-offset: 2px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.75rem; padding: .6rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--rule); }
.bar-home { font-weight: 700; text-decoration: none; }
.bar-nav { display: flex; flex-wrap: wrap; gap: .1rem .3rem; flex: 1; }
.bar-nav a { padding: .3rem .6rem; border-radius: 6px; text-decoration: none; color: var(--ink-2); }
.bar-nav a:hover { color: var(--ink); background: var(--paper); }
.bar-nav a[aria-current] { color: var(--ink); font-weight: 600; background: var(--paper); }
.count { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 99px; background: var(--uv); color: #fff; font-size: .78em; font-weight: 700; text-align: center; }
.bar-user { display: flex; gap: .75rem; align-items: center; color: var(--ink-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.35rem; padding: .35rem .95rem; border: 1px solid var(--uv); border-radius: var(--r); background: var(--uv); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #3220c4; }
.btn-quiet { background: var(--card); color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover { background: var(--paper); border-color: #b8b6c2; }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: #8f1d17; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.link:hover { color: var(--ink); }
.link-danger { color: var(--bad); }
.pill { display: inline-block; padding: .05rem .55rem; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: #e8e7ee; color: var(--ink-2); }
.pill-live { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-block; padding: 0 .45rem; border-radius: 4px; background: #ececf1; color: var(--ink-2); font-size: .8rem; }
.tag-warn { background: var(--warn-soft); color: var(--warn); }

.flash { margin: .9rem 1.25rem 0; padding: .55rem .9rem; border-radius: var(--r); background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.auth-box .flash { margin: 0; }

.main { padding: 1.25rem; }
.content { max-width: 960px; margin-inline: auto; display: grid; gap: 1.25rem; }
.narrow { max-width: 560px; margin-inline: auto; display: grid; gap: 1rem; }
.stack { display: grid; gap: 1rem; }
.note { color: var(--ink-2); margin: 0; }
.actions { display: flex; gap: .6rem; }

/* Formulare */
.f { display: grid; gap: .2rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.f > span, .f > legend { font-weight: 600; padding: 0; }
.f small, .hint { color: var(--ink-2); font-size: .85rem; }
input:not([type=checkbox], [type=radio], [type=color], [type=range], [type=file]), select, textarea {
  width: 100%; min-height: 2.35rem; padding: .4rem .6rem; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule); border-radius: 6px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--uv); outline-offset: -1px; border-color: var(--uv); }
textarea { resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
input[type=range] { width: 100%; accent-color: var(--uv); }
input[type=color] { width: 100%; height: 2.5rem; padding: 2px; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); cursor: pointer; }
.check { display: flex; gap: .5rem; align-items: center; cursor: pointer; font-weight: 500; }
.check input { accent-color: var(--uv); width: 1.05rem; height: 1.05rem; }
.grid2 { display: grid; gap: .9rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.form-sections { display: grid; gap: 1rem; }
.form-sections section, .danger-zone, .howto { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 1.1rem 1.25rem; display: grid; gap: .8rem; }
.sticky-save { position: sticky; bottom: 0; padding: .6rem 0; background: linear-gradient(transparent, var(--paper) 35%); }
.inline-form { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: flex-end; }
.inline-form .f { flex: 1 1 240px; }
.inline-form .grow { flex: 1 1 240px; margin: 0; }
.inline-form-3 .f { flex-basis: 180px; }
.danger-zone form + form { border-top: 1px solid var(--rule); padding-top: .9rem; }
.howto ol { margin: 0; padding-left: 1.25rem; display: grid; gap: .4rem; }
.howto p { margin: 0; color: var(--ink-2); }

.seg { display: flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: var(--card); }
.seg label { flex: 1; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: .4rem .3rem; font-weight: 500; }
.seg label + label span { border-left: 1px solid var(--rule); }
.seg input:checked + span { background: var(--uv-soft); color: var(--uv); font-weight: 650; }
.seg input:focus-visible + span { outline: 2px solid var(--uv); outline-offset: -2px; }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.warn { margin: 0; padding: .45rem .7rem; background: var(--warn-soft); color: var(--warn); border-radius: 6px; }
.pick { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.pick img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; background: #e8e7ee; }

/* Flyerwand: jede Kachel trägt das Design ihrer Webseite */
.wall-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.wall { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem 1.25rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.wall-sub { margin: 2.5rem 0 1rem; color: var(--ink-2); }
.wall-past .flyer { filter: saturate(.55); }
.flyer {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  aspect-ratio: 3 / 4.1; overflow: hidden; container-type: inline-size;
  background: var(--f-bg); color: var(--f-text); text-decoration: none; border-radius: 4px;
  box-shadow: 0 1px 2px rgb(20 18 40 / .18);
  transition: translate .16s ease-out, box-shadow .16s ease-out;
}
.flyer:hover { translate: 0 -3px; box-shadow: 0 10px 22px rgb(20 18 40 / .22); }
.flyer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.flyer-title { position: relative; padding: 0 8cqi 6cqi; font-family: var(--f-font), sans-serif; text-transform: var(--f-case); line-height: .98; overflow-wrap: anywhere; }
.flyer-l { font-size: 21cqi; }
.flyer-m { font-size: 15cqi; }
.flyer-s { font-size: 11cqi; }
.flyer-strip { position: relative; padding: 3.2cqi 8cqi; background: var(--f-accent); color: var(--f-on); font-weight: 650; font-size: 13px; }
.flyer-meta { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; min-width: 0; }
.flyer-domain { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; }
.flyer-item { min-width: 0; }
.empty { background: var(--card); border: 1px dashed #b8b6c2; border-radius: 10px; padding: 3rem 1.5rem; text-align: center; display: grid; gap: .6rem; justify-items: center; }
.empty p { margin: 0; color: var(--ink-2); max-width: 44ch; }

.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: .5rem; margin-top: .3rem; }
.preset input { position: absolute; opacity: 0; }
.preset { cursor: pointer; }
.preset-btn { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; text-align: left; border-radius: 6px; }
.preset-card { display: flex; flex-direction: column; justify-content: space-between; height: 62px; padding: .4rem .5rem 0; background: var(--p-bg); color: var(--p-text); font-family: var(--p-font), sans-serif; border-radius: 6px; overflow: hidden; outline: 2px solid transparent; outline-offset: 2px; }
.preset-card b { font-weight: 400; font-size: 15px; line-height: 1.05; }
.preset-card i { display: block; height: 7px; margin-inline: -.5rem; background: var(--p-accent); }
.preset input:checked + .preset-card, .preset-btn.is-active .preset-card { outline-color: var(--uv); }
.preset input:focus-visible + .preset-card { outline-color: var(--uv); }

/* Webseiten-Kopf */
.sitebar { background: var(--card); border-bottom: 1px solid var(--rule); padding: .85rem 1.25rem 0; }
.sitebar-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; }
.sitebar-head h1 { font-size: 1.3rem; }
.sitebar-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; }
.tabs { display: flex; gap: .15rem; margin-top: .55rem; overflow-x: auto; }
.tabs a { padding: .4rem .7rem; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--ink); font-weight: 600; border-bottom-color: var(--uv); }
.tabs-inline { border-bottom: 1px solid var(--rule); margin-top: 0; }

/* Listen */
.rows { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; padding: .65rem .9rem; }
.row + .row { border-top: 1px solid var(--rule); }
.row-main { flex: 1 1 220px; min-width: 0; display: grid; text-decoration: none; }
.row-main span { color: var(--ink-2); font-size: .875rem; overflow-wrap: anywhere; }
a.row-main:hover strong { text-decoration: underline; }
.row-unread strong::before { content: ""; display: inline-block; width: .5em; height: .5em; margin-right: .45em; border-radius: 50%; background: var(--uv); vertical-align: .08em; }
.row-tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.row-actions { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.grip { cursor: grab; color: #a3a1ae; user-select: none; }
.pw summary { list-style: none; }
.pw summary::-webkit-details-marker { display: none; }
.pw-form { display: flex; gap: .5rem; margin-top: .5rem; }

.dropzone { padding: 1.5rem; text-align: center; background: var(--card); border: 1.5px dashed #b8b6c2; border-radius: 10px; }
.dropzone p { margin: 0 0 .15rem; }
.dropzone small { color: var(--ink-2); }
.dropzone.is-over { border-color: var(--uv); background: var(--uv-soft); }
.mediagrid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.mediagrid li { display: grid; gap: .4rem; align-content: start; }
.mediagrid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #e8e7ee; }
.message { margin: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.25rem; }
.message dt { font-weight: 600; margin-top: .75rem; }
.message dt:first-child { margin-top: 0; }
.message dd { margin: 0; overflow-wrap: anywhere; }

/* Editor mit Vorschau */
@media (min-width: 901px) {
  body:has(.studio) { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body:has(.studio) .main { flex: 1; min-height: 0; }
}
.main:has(.studio) { padding: 0; }
.studio { display: grid; grid-template-columns: minmax(380px, 460px) 1fr; height: 100%; }
.studio-side { overflow-y: auto; padding: 1rem; border-right: 1px solid var(--rule); background: var(--paper); align-content: start; }
.studio-tools { position: sticky; top: -1rem; z-index: 5; display: flex; align-items: center; gap: .75rem; margin: -1rem -1rem .75rem; padding: .6rem 1rem; background: var(--paper); border-bottom: 1px solid var(--rule); }
.studio-state { margin-left: auto; color: var(--ink-2); font-size: .875rem; }
.studio-state.is-dirty { color: var(--warn); font-weight: 600; }
.studio-state.is-error { color: var(--bad); font-weight: 600; }
.studio-preview { display: grid; grid-template-rows: auto 1fr; justify-items: center; padding: .6rem; gap: .5rem; min-width: 0; background: #e6e5ea; }
.studio-preview iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 6px; box-shadow: 0 1px 3px rgb(20 18 40 / .2); }
.studio-preview.is-mobile iframe { width: 390px; max-width: 100%; }
.device-switch { display: inline-flex; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.device-switch button { padding: .2rem .8rem; border: 0; background: none; font: inherit; cursor: pointer; color: var(--ink-2); }
.device-switch button[aria-pressed=true] { background: var(--uv-soft); color: var(--uv); font-weight: 600; }
@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; height: auto; }
  .studio-side { border-right: 0; overflow: visible; }
  .studio-tools { top: 0; }
  .studio-preview { display: none; }
}

.pageprops { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: .5rem .75rem; margin-bottom: .75rem; }
.pageprops summary { cursor: pointer; font-weight: 600; }
.pageprops[open] summary { margin-bottom: .75rem; }
.blocks { display: grid; gap: .5rem; }
.bk { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; }
.bk.is-hidden .bk-title { opacity: .5; text-decoration: line-through; }
.bk-head { display: flex; align-items: center; gap: .4rem; padding: .35rem .5rem; }
.bk-toggle { flex: 1; min-width: 0; display: grid; text-align: left; background: none; border: 0; font: inherit; cursor: pointer; padding: .2rem .25rem; color: inherit; }
.bk-title { font-weight: 600; }
.bk-sub { color: var(--ink-2); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-btn { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; background: none; border: 0; border-radius: 5px; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.bk-btn:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.bk-btn:disabled { opacity: .3; cursor: default; }
.bk-body { padding: .6rem .75rem .9rem; border-top: 1px solid var(--rule); display: grid; gap: .8rem; }
.btn-add { width: 100%; margin-top: .6rem; border-style: dashed; }
.sortable-ghost { opacity: .35; }

.rep { display: grid; gap: .5rem; }
.rep-row { display: grid; grid-template-columns: auto 1fr auto; gap: .4rem; padding: .5rem; background: var(--paper); border-radius: 6px; }
.rep-tools { display: grid; align-content: start; }
.row-move { display: flex; }
.rep-fields { display: grid; gap: .5rem; min-width: 0; }
.images { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .4rem; }
.images figure { position: relative; margin: 0; cursor: grab; }
.images img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; background: #e8e7ee; }
.images button { width: 1.4rem; height: 1.4rem; border: 0; border-radius: 50%; background: rgb(0 0 0 / .65); color: #fff; cursor: pointer; font-size: 11px; }
.images button:disabled { opacity: .35; cursor: default; }
.images figure > button { position: absolute; top: 2px; right: 2px; }
.img-move { position: absolute; left: 2px; right: 2px; bottom: 2px; display: flex; justify-content: space-between; }

.rt { border: 1px solid var(--rule); border-radius: 6px; background: var(--card); }
.rt:focus-within { outline: 2px solid var(--uv); outline-offset: -1px; }
.rt-bar { display: flex; flex-wrap: wrap; gap: .1rem; padding: .2rem; border-bottom: 1px solid var(--rule); }
.rt-bar button { min-width: 1.9rem; height: 1.75rem; padding: 0 .35rem; background: none; border: 0; border-radius: 4px; font: inherit; font-size: 13px; cursor: pointer; }
.rt-bar button:hover { background: var(--paper); }
.rt-area { min-height: 6rem; padding: .5rem .65rem; outline: 0; }
.rt-area > :first-child { margin-top: 0; }
.rt-area > :last-child { margin-bottom: 0; }
.rt-area h2 { font-size: 1.25rem; margin: 1rem 0 .4rem; }
.rt-area h3 { font-size: 1.05rem; margin: .9rem 0 .3rem; }
.rt-area p { margin: 0 0 .6rem; }
.rt-tall .rt-area { min-height: 26rem; }

dialog { border: 0; border-radius: 12px; padding: 0; box-shadow: 0 20px 60px rgb(20 18 40 / .3); color: inherit; }
dialog::backdrop { background: rgb(20 18 40 / .45); }
.palette, .picker { width: min(760px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); }
.palette[open], .picker[open] { display: flex; flex-direction: column; }
.palette header, .picker header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--rule); }
.palette-grid { padding: .9rem; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); overflow-y: auto; }
.palette-grid button { display: grid; text-align: left; padding: .6rem .75rem; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; font: inherit; cursor: pointer; }
.palette-grid button:hover { border-color: var(--uv); background: var(--uv-soft); }
.palette-grid b { font-weight: 650; }
.palette-grid span { color: var(--ink-2); font-size: .85rem; }
.picker-grid { padding: .9rem; overflow-y: auto; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); flex: 1; }
.picker-grid button { padding: 0; border: 2px solid transparent; border-radius: 7px; background: none; cursor: pointer; }
.picker-grid button[aria-pressed=true] { border-color: var(--uv); }
.picker-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; background: #e8e7ee; }
.picker footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1.1rem; border-top: 1px solid var(--rule); }

.toast { position: fixed; left: 50%; bottom: 1.25rem; translate: -50% 0; z-index: 90; display: flex; gap: 1rem; align-items: center; padding: .55rem 1rem; background: var(--ink); color: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgb(20 18 40 / .3); }
.toast button { background: none; border: 0; color: #fff; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.auth-box { width: min(380px, 100%); background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 1.5rem; display: grid; gap: .9rem; }
.auth-box p { margin: 0; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
