/* Backend Zaubernäscht. Farben und Schriften aus assets/css/tokens.css */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-text); font-size: 15.5px; line-height: 1.5; color: var(--color-text); background: var(--zn-sand-hell); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: var(--zn-oliv-tief); }
h1, h2, h3, legend { font-family: var(--font-display); font-weight: 400; line-height: 1.15; margin: 0; font-variant-numeric: lining-nums; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; }
p { margin: 0; }
code { background: var(--zn-sand-hell); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: 6px; }
.i { width: 1.2em; height: 1.2em; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--color-text-muted); }
.klein { font-size: .88rem; }
.rechts { text-align: right; }
.zahl { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Grundgerüst */
.admin { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--zn-oliv-tief); color: var(--zn-sand-hell); padding: 1.25rem .9rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.25rem; }
.side-brand { display: flex; align-items: center; gap: .65rem; color: var(--zn-weiss); text-decoration: none; padding: 0 .5rem; }
.side-brand span { font-family: var(--font-display); font-size: 1.25rem; line-height: 1; }
.side-brand small { display: block; font: 600 .68rem var(--font-text); letter-spacing: .14em; text-transform: uppercase; color: var(--zn-sand); margin-top: .3rem; }
.side-brand img { background: var(--zn-sand); border-radius: 50%; }
.side-toggle { display: none; }
.side-nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.side-nav a, .side-nav button { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 10px; color: var(--zn-sand-hell); text-decoration: none; font: 500 .97rem var(--font-text); background: none; border: 0; width: 100%; cursor: pointer; text-align: left; }
.side-nav a:hover, .side-nav button:hover { background: rgba(255,255,255,.08); color: var(--zn-weiss); }
.side-nav a.aktiv { background: var(--zn-sand-hell); color: var(--zn-oliv-tief); font-weight: 600; }
.badge { margin-left: auto; background: var(--zn-altrosa); color: var(--zn-weiss); font-size: .78rem; padding: .05rem .5rem; border-radius: 999px; }
.side-nav a.aktiv .badge { background: var(--zn-altrosa-tief); }
.side-foot { margin-top: auto; border-top: 1px solid rgba(243,232,218,.2); padding-top: .75rem; }
.main { padding: 2rem clamp(1rem, 3vw, 2.75rem) 4rem; max-width: 1180px; width: 100%; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: sticky; z-index: 10; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: .7rem 1rem; }
  .side-toggle { display: inline-flex; background: rgba(255,255,255,.12); color: var(--zn-weiss); border: 0; border-radius: 10px; padding: .55rem .7rem; cursor: pointer; }
  .side-nav { display: none; flex-basis: 100%; }
  .side-nav.offen { display: flex; }
}

/* Kopf, Karten, Raster */
.kopf { margin-bottom: 1.5rem; display: grid; gap: .4rem; }
.kopf-zeile { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.zurueck { margin-bottom: .6rem; font-size: .92rem; }
.zurueck a::before { content: "\2190\00a0"; }
.karte { background: var(--zn-weiss); border-radius: 16px; padding: 1.5rem; margin-bottom: 1.25rem; box-shadow: 0 1px 2px rgba(61,58,44,.06), 0 10px 30px -22px rgba(61,58,44,.35); }
.karte-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.raster-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.raster-2 > .karte { margin-bottom: 0; }
.raster-2 + * { margin-top: 1.25rem; }
@media (max-width: 860px) { .raster-2 { grid-template-columns: 1fr; } }
.kacheln { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.kachel { background: var(--zn-weiss); border-radius: 16px; padding: 1.25rem 1.4rem; text-decoration: none; color: var(--color-text); display: grid; gap: .2rem; box-shadow: 0 1px 2px rgba(61,58,44,.06); transition: transform .15s; }
.kachel:hover { transform: translateY(-2px); }
.kachel strong { font-family: var(--font-display); font-size: 2.3rem; font-weight: 400; line-height: 1; font-variant-numeric: lining-nums; }
.kachel span { color: var(--color-text-muted); }
.kachel.betont { background: var(--zn-altrosa-tief); color: var(--zn-weiss); }
.kachel.betont span { color: var(--zn-sand-hell); }
@media (max-width: 700px) { .kacheln { grid-template-columns: 1fr; } }
.schnell, .knoepfe { display: flex; flex-wrap: wrap; gap: .6rem; }
.leer { color: var(--color-text-muted); padding: .5rem 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; font: 600 .95rem/1 var(--font-text); padding: .78rem 1.15rem; border-radius: 999px; border: 2px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, transform .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--zn-oliv-tief); color: var(--zn-weiss); }
.btn-primary:hover { background: #3f442b; }
.btn-ghost { background: transparent; color: var(--zn-oliv-tief); border-color: currentColor; }
.btn-ghost:hover { background: var(--zn-sand-hell); }
.btn-gefahr { background: transparent; color: var(--zn-altrosa-tief); border-color: currentColor; }
.btn-gefahr:hover { background: var(--zn-altrosa-hell); }
.icon-knopf, .icon-link { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 10px; border: 1px solid var(--color-line); background: var(--zn-weiss); color: var(--zn-oliv-tief); cursor: pointer; }
.icon-knopf:hover, .icon-link:hover { background: var(--zn-sand-hell); }
.gefahr-icon { color: var(--zn-altrosa-tief); }
.gefahr { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--color-line); }

/* Meldungen */
.flash { display: flex; gap: .6rem; align-items: center; padding: .85rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-weight: 600; }
.flash-ok { background: var(--zn-oliv-hell); }
.flash-fehler { background: var(--zn-altrosa-hell); color: #4d3838; }
.hinweis { display: flex; gap: .7rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 12px; margin-bottom: 1.25rem; }
.hinweis.warn { background: var(--zn-altrosa-hell); }
.feld-fehler { color: var(--zn-altrosa-tief); font-size: .85rem; font-weight: 600; }

/* Tabellen */
.tabelle-wrap { overflow-x: auto; margin: 0 -.25rem; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabelle th { text-align: left; font-weight: 600; color: var(--color-text-muted); font-size: .82rem; padding: .5rem .6rem; border-bottom: 1px solid var(--color-line); white-space: nowrap; }
.tabelle td { padding: .7rem .6rem; border-bottom: 1px solid rgba(61,58,44,.08); vertical-align: middle; }
.tabelle tr[data-href] { cursor: pointer; }
.tabelle tbody tr:hover { background: #fbf7f1; }
.tabelle td a { font-weight: 600; text-decoration: none; }
.tabelle td a:hover { text-decoration: underline; }
.status { display: inline-block; font-size: .78rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; background: var(--zn-sand-hell); white-space: nowrap; }
.s-neu { background: var(--zn-altrosa-tief); color: var(--zn-weiss); }
.s-in_bearbeitung { background: var(--zn-sand); }
.s-bestaetigt, .r-bezahlt { background: var(--zn-oliv-hell); }
.s-warteliste { background: var(--zn-altrosa-hell); }
.s-abgesagt, .r-storniert { background: #e4ded5; color: var(--color-text-muted); }
.r-offen { background: var(--zn-sand); }
.tag { font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 6px; background: var(--zn-altrosa-hell); vertical-align: middle; }
.filter { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.filter a { text-decoration: none; padding: .45rem .85rem; border-radius: 999px; background: var(--zn-weiss); color: var(--color-text); font-weight: 500; font-size: .92rem; }
.filter a b { color: var(--color-text-muted); font-weight: 600; margin-left: .2rem; }
.filter a.aktiv { background: var(--zn-oliv-tief); color: var(--zn-weiss); }
.filter a.aktiv b { color: var(--zn-sand); }
.liste { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.liste li { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.daten { display: grid; grid-template-columns: 9rem 1fr; gap: .55rem 1rem; margin: 0; }
.daten dt { color: var(--color-text-muted); }
.daten dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Formulare */
.formular .felder { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.1rem; margin-bottom: 1.2rem; }
.felder.einspaltig { grid-template-columns: 1fr; }
.formular label, .karte > label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
.karte > label { margin-bottom: 1rem; }
.formular label small, label small { font-weight: 400; color: var(--color-text-muted); }
.breit { grid-column: 1 / -1; }
@media (max-width: 700px) { .formular .felder { grid-template-columns: 1fr; } }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number], input[type=date], input[type=password], select, textarea {
  font: 400 1rem/1.4 var(--font-text); color: var(--color-text); width: 100%; background: var(--zn-weiss);
  border: 1.5px solid #9d8f79; border-radius: 10px; padding: .6rem .75rem;
}
input[type=file] { font: inherit; font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--zn-oliv-tief); box-shadow: 0 0 0 3px rgba(79,85,54,.22); }
input:disabled { background: var(--zn-sand-hell); color: var(--color-text-muted); }
textarea { resize: vertical; }
label.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; }
label.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--zn-oliv-tief); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .45rem; }
legend { font-family: var(--font-text); font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.praefix { display: flex; align-items: stretch; }
.praefix span { display: grid; place-items: center; padding: 0 .6rem; background: var(--zn-sand-hell); border: 1.5px solid #9d8f79; border-right: 0; border-radius: 10px 0 0 10px; font-weight: 400; }
.praefix input { border-radius: 0 10px 10px 0; }
.sprung { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.sprung a { font-size: .9rem; padding: .3rem .75rem; background: var(--zn-weiss); border-radius: 999px; text-decoration: none; }
form.karte { scroll-margin-top: 1rem; }
.schmal { max-width: 560px; }

/* Bildfeld */
.bildfeld { display: grid; grid-template-columns: 180px 1fr; gap: 1rem; align-items: start; margin-bottom: 1.2rem; }
.bildfeld > div { display: grid; gap: .7rem; }
.vorschau { width: 180px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; }
.leer-bild { display: grid; place-items: center; background: var(--zn-sand-hell); color: var(--color-text-muted); font-size: .85rem; }
@media (max-width: 600px) { .bildfeld { grid-template-columns: 1fr; } }

/* Editor */
.editor { border: 1.5px solid #9d8f79; border-radius: 10px; background: var(--zn-weiss); grid-column: 1 / -1; margin-top: -.6rem; }
.editor:focus-within { border-color: var(--zn-oliv-tief); box-shadow: 0 0 0 3px rgba(79,85,54,.22); }
.editor-bar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .4rem; border-bottom: 1px solid var(--color-line); background: #fbf7f1; border-radius: 10px 10px 0 0; }
.editor-bar button { font: 500 .85rem var(--font-text); padding: .35rem .6rem; border: 1px solid transparent; border-radius: 7px; background: none; cursor: pointer; color: var(--color-text); }
.editor-bar button:hover { background: var(--zn-weiss); border-color: var(--color-line); }
.editor-area { min-height: 180px; padding: .8rem 1rem; outline: none; font-weight: 400; font-size: 1rem; line-height: 1.6; }
.editor-area > * + * { margin-top: .7rem; }
.editor-area h2 { font-size: 1.4rem; margin: 1rem 0 .4rem; }
.editor-area h3 { font-size: 1.15rem; }
.editor-area ul, .editor-area ol { padding-left: 1.3em; }

/* Wiederholbare Zeilen, Positionen */
.wiederholen { display: grid; gap: .8rem; margin-bottom: .8rem; }
.zeile { display: grid; grid-template-columns: 1fr 2fr auto; gap: .8rem; align-items: end; padding-bottom: .8rem; border-bottom: 1px solid var(--color-line); }
@media (max-width: 700px) { .zeile { grid-template-columns: 1fr auto; } .zeile label:nth-child(2) { grid-column: 1 / -1; grid-row: 2; } }
.positionen { display: grid; gap: .5rem; margin-bottom: .8rem; }
.pos, .pos-kopf { display: grid; grid-template-columns: 1fr 5.5rem 7.5rem 7rem 2.25rem; gap: .5rem; align-items: center; }
.pos-kopf { font-size: .82rem; color: var(--color-text-muted); font-weight: 600; }
.pos output { font-weight: 600; }
.pos-fuss { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.total { font-size: 1.1rem; }
.total strong { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; margin-left: .5rem; font-variant-numeric: lining-nums tabular-nums; }
@media (max-width: 700px) {
  .pos-kopf { display: none; }
  .pos { grid-template-columns: 1fr 1fr 2.25rem; padding-bottom: .6rem; border-bottom: 1px solid var(--color-line); }
  .pos input:first-child { grid-column: 1 / -1; }
  .pos output { display: none; }
}

/* Fotos und Dokumente */
.foto-raster { list-style: none; padding: 0; margin: 0 0 1.2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.foto-raster li { display: grid; gap: .5rem; }
.foto-raster img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; }
.foto-aktionen { display: flex; gap: .35rem; }
.dok-liste { list-style: none; padding: 0; margin: 0 0 1.2rem; display: grid; gap: .6rem; }
.dok-liste li { display: grid; grid-template-columns: auto 1fr auto auto; gap: .7rem; align-items: center; }
.dok-liste .i { color: var(--zn-altrosa-tief); width: 1.6rem; height: 1.6rem; }
@media (max-width: 600px) { .dok-liste li { grid-template-columns: auto 1fr; } }

/* Login und Ersteinrichtung */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--zn-sand); padding: 1rem; }
.auth-card { background: var(--zn-weiss); border-radius: 20px; padding: 2rem; width: min(100%, 420px); display: grid; gap: 1rem; justify-items: center; text-align: center; box-shadow: 0 30px 60px -40px rgba(61,58,44,.6); }
.auth-card h1 { font-size: 1.8rem; }
.stack { display: grid; gap: .9rem; width: 100%; text-align: left; }
.stack label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
.stack .btn { justify-content: center; margin-top: .3rem; }
