/* Halloween-Klingelliste
   Ein Nacht-Look: Aubergine-Himmel, Kürbis-Orange als Akzent, Kerzenlicht für Überschriften.
   Schriften kommen vom System (keine externen Schriftdienste, DSGVO-freundlich). */
:root {
  color-scheme: dark;
  --night: #1c1726;
  --panel: #272035;
  --line: #3a3150;
  --ink: #f4ede1;
  --muted: #aba2bf;
  --pumpkin: #ff8c2a;
  --candle: #ffd27a;
  --teal: #3cc2b4;
  --ok: #7fd18b;
  --bad: #ff7a7a;
  --f-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--night); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.55;
  background-image: radial-gradient(ellipse 70% 360px at 50% -40px, rgba(255, 140, 42, .16), transparent 70%);
  background-repeat: no-repeat;
}
a { color: var(--candle); }
.wrap {
  position: relative;
  max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 40px;
  padding-block: 40px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2 { font-family: var(--f-display); font-weight: 700; margin: 0; line-height: 1.08; text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 7.5vw, 3.8rem); color: var(--candle); font-style: italic; text-shadow: 0 0 26px rgba(255, 180, 80, .3); }
h2 { font-size: clamp(1.6rem, 4.5vw, 2.1rem); }
p { margin: 0; max-width: 64ch; }
code { background: var(--panel); padding: 1px 5px; border-radius: 4px; }
section { display: flex; flex-direction: column; gap: 16px; }
.top { display: flex; flex-direction: column; gap: 12px; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--pumpkin); font-weight: 700; }
.eyebrow a { color: inherit; }
.lead { color: var(--muted); font-size: 1.07rem; }
.date { font-variant-numeric: tabular-nums; color: var(--muted); }
.date b { color: var(--pumpkin); }
.count, .empty { color: var(--muted); }
.empty { border: 1px dashed var(--line); border-radius: 10px; padding: 20px; max-width: none; }

/* Logo oben rechts */
.logo-m { display: none; }
/* Höhe kommt aus config.php (logo_height), Breite aus dem Seitenverhältnis des Bildes */
.logo { position: absolute; top: 24px; right: max(16px, env(safe-area-inset-right, 0px)); display: block; }
.logo img { display: block; height: auto; width: auto; max-height: var(--logo-h, 88px); max-width: var(--logo-w, 88px); object-fit: contain; }
body.has-logo .top { padding-right: calc(var(--logo-w, 88px) + 20px); min-height: var(--logo-h, 88px); }
@media (max-width: 560px) {
  /* Am Handy steht das Logo neben der Überschrift und ist genauso hoch */
  .logo { display: none; }
  body.has-logo .top { padding-right: 0; min-height: 0; }
  .titlerow { display: flex; align-items: stretch; gap: 14px; }
  .titlerow h1 { flex: 1 1 auto; min-width: 0; }
  .logo-m { display: block; position: relative; flex: none; width: calc(80px * var(--logo-ratio, 1)); max-width: 40vw; }
  .logo-m img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: right center; }
}

/* Aufklappbare Erklärung */
.explain { font-size: .92rem; color: var(--muted); }
.explain summary { cursor: pointer; color: var(--teal); display: inline-flex; align-items: center; gap: 6px; list-style: none; }
.explain summary::-webkit-details-marker { display: none; }
.explain summary::before { content: "i"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; font: 700 .72rem/1 Georgia, serif; font-style: italic; }
.explain summary:hover { text-decoration: underline; }
.explain[open] summary { margin-bottom: 6px; }
.explain p { border-left: 2px solid var(--teal); padding-left: 12px; max-width: 64ch; }
.form .explain { margin: -6px 0 0 28px; }

/* Karte */
.mapbox { gap: 10px; }
#map { height: min(62vh, 460px); min-height: 300px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); z-index: 0; }
#map.admin { height: 380px; }
.leaflet-tile-pane { filter: invert(1) hue-rotate(195deg) brightness(.85) contrast(.9) saturate(.5); }
.leaflet-container { font-family: var(--f-body); background: var(--panel); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.leaflet-popup-content { margin: 12px 14px; line-height: 1.45; }
.leaflet-popup-content b { font-size: 1.05rem; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-control-attribution { background: rgba(28, 23, 38, .85) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--candle); }
.leaflet-bar a { background: var(--panel); color: var(--ink); border-color: var(--line); }
.pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 8%; transform: rotate(-45deg); background: var(--pumpkin); border: 2px solid var(--night); box-shadow: 0 0 0 2px var(--pumpkin), 0 0 14px rgba(255, 140, 42, .7); }
.pin.teal { background: var(--teal); box-shadow: 0 0 0 2px var(--teal), 0 0 14px rgba(60, 194, 180, .6); }
.pin.pend { background: var(--candle); box-shadow: 0 0 0 2px var(--candle); }
.pin.flag { background: var(--bad); box-shadow: 0 0 0 2px var(--bad); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); }
.legend span { display: inline-flex; gap: 7px; align-items: center; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--pumpkin); display: inline-block; }
.dot.teal { background: var(--teal); }
.picknote { color: var(--candle); }

/* Liste */
.sechead { display: flex; gap: 14px; align-items: end; justify-content: space-between; flex-wrap: wrap; }
.sechead input { flex: 0 1 260px; }
.street h3 { margin: 6px 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.house { display: grid; grid-template-columns: 4rem 1fr auto; gap: 14px; align-items: start; padding: 12px 0; border-top: 1px dashed var(--line); }
.house.admin { grid-template-columns: 4rem 1fr; }
.house.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(255, 140, 42, .18); } to { background: transparent; } }
.nr { font-family: var(--f-display); font-weight: 700; font-size: 1.7rem; line-height: 1; color: var(--pumpkin); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.info { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.who { font-weight: 700; }
.note { color: var(--muted); font-size: .94rem; overflow-wrap: anywhere; }
.sel { user-select: all; color: var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { font-size: .78rem; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--candle); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.teal { color: var(--teal); border-color: rgba(60, 194, 180, .5); }
.chip.pend { color: var(--night); background: var(--candle); border-color: var(--candle); }
.chip.okc { color: var(--ok); border-color: var(--ok); }
.chip.flag { color: var(--bad); border-color: var(--bad); }
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.acts form { margin: 0; }
.acts form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.acts input[type=number] { width: 90px; }

/* Bedienelemente */
select, input[type=text], input[type=email], input[type=tel], input[type=search], input[type=time], input[type=password], input[type=number], textarea {
  width: 100%; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 12px; font: inherit;
}
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--candle); outline-offset: 2px; }
.btn { display: inline-block; background: var(--pumpkin); color: #2a1606; border: 0; border-radius: 8px; padding: 12px 22px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.sm { padding: 7px 14px; font-size: .9rem; }
.ghost { display: inline-block; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 6px 11px; font: inherit; font-size: .84rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.ghost:hover { color: var(--ink); border-color: var(--muted); }
.ghost.danger:hover { color: var(--bad); border-color: var(--bad); }
.ghost[disabled] { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--candle); font: inherit; font-size: .84rem; cursor: pointer; text-decoration: underline; }

/* Formular */
.form { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.form.narrow { max-width: 360px; grid-template-columns: 1fr; }
.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; grid-column: span 3; }
.f.wide { grid-column: span 4; }
.f:has(#nr), .f:has(#plz) { grid-column: span 2; }
.f.half { grid-column: span 3; }
.full, .f.full { grid-column: 1 / -1; }
.f label { font-size: .86rem; font-weight: 700; }
.privacy { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pcol { border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pcol h3 { margin: 0; font-size: 1rem; }
.pcol.pub { background: rgba(255, 140, 42, .10); border: 1px solid rgba(255, 140, 42, .45); }
.pcol.pub h3 { color: var(--pumpkin); }
.pcol.priv { background: rgba(60, 194, 180, .08); border: 1px solid rgba(60, 194, 180, .45); }
.pcol.priv h3 { color: var(--teal); }
.pcol h3::before { display: inline-block; width: 1.3em; }
.pcol.pub h3::before { content: "👁"; }
.pcol.priv h3::before { content: "🔒"; }
.psub { color: var(--muted); font-size: .86rem; }
.pcol ul { margin: 4px 0 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 3px; }
.pfoot { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; max-width: none; }
.tag { font-size: .7rem !important; font-weight: 700 !important; text-transform: uppercase; letter-spacing: .06em; padding: 1px 7px; border-radius: 999px; margin-left: 4px; white-space: nowrap; }
.tag.pub { color: var(--pumpkin) !important; border: 1px solid rgba(255, 140, 42, .5); }
.tag.priv { color: var(--teal) !important; border: 1px solid rgba(60, 194, 180, .5); }
@media (max-width: 560px) { .privacy { grid-template-columns: 1fr; } }
.req { color: var(--pumpkin); font-weight: 700; }
.formnote { color: var(--muted); font-size: .92rem; max-width: none; }
.f small, .f label small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.codefield input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.2rem; letter-spacing: .2em; text-transform: uppercase; max-width: 260px; }
.time2 { display: flex; gap: 10px; align-items: center; }
.time2 select { width: auto; min-width: 96px; font-variant-numeric: tabular-nums; cursor: pointer; }
.chk { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.chk input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--pumpkin); flex: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.box { border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.box.ok { background: rgba(127, 209, 139, .12); border: 1px solid rgba(127, 209, 139, .5); }
.box.err { background: rgba(255, 122, 122, .1); border: 1px solid rgba(255, 122, 122, .55); }
.card { background: var(--panel); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.addr { font-family: var(--f-display); font-size: 1.6rem; line-height: 1.2; color: var(--candle); }
.addr span { font-size: 1.1rem; color: var(--muted); }
.actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.actions form { display: flex; gap: 10px; align-items: center; margin: 0; }

.how { background: var(--panel); border-radius: 14px; padding: 22px; }
.how h2 { font-size: 1.45rem; }
.how ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 8px; color: var(--muted); }
.how li b { color: var(--ink); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(20px, env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--night); padding: 11px 18px; border-radius: 10px; font-weight: 700; z-index: 1000; max-width: calc(100% - 32px); }
footer { color: var(--muted); font-size: .84rem; border-top: 1px solid var(--line); padding-top: 18px; display: flex; flex-direction: column; gap: 4px; }
[hidden] { display: none !important; }

/* Flyer zum Ausdrucken */
.flyers { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.flyer { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; break-inside: avoid; }
.flyer b { font-family: var(--f-display); font-size: 1.2rem; color: var(--candle); }
.flyer .u { font-weight: 700; overflow-wrap: anywhere; }
.flyer .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.6rem; letter-spacing: .2em; color: var(--pumpkin); }
@media print {
  :root { color-scheme: light; --night: #fff; --ink: #000; --muted: #333; --line: #888; --candle: #000; --pumpkin: #000; }
  body { background: #fff; }
  .noprint, footer { display: none; }
  .wrap { padding: 0; max-width: none; }
  .flyers { grid-template-columns: repeat(3, 1fr); gap: 0; }
  .flyer { border-radius: 0; height: 6.2cm; }
}

@media (max-width: 560px) {
  .form { grid-template-columns: repeat(2, 1fr); }
  .f, .f.wide, .f.half { grid-column: 1 / -1; }
  .f:has(#nr), .f:has(#plz) { grid-column: span 1; }
  .house { grid-template-columns: 3rem 1fr; }
  .house > .ghost { grid-column: 2; justify-self: start; }
  .sechead input { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { .house.flash { animation: none; } }
