/* =========================================================
   Knieschleifer Regio-Karte – Styles
   ========================================================= */

:root,
:root[data-theme='dark'] {
  --bg: #0d0e12;
  --surface: rgba(20, 22, 28, 0.86);
  --surface-solid: #16181e;
  --surface-2: #1d2027;
  --surface-3: #282c35;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #f3f4f6;
  --text-2: #c9ccd3;
  --muted: #8d939f;
  --red: #e3122d;
  --red-2: #ff4258;
  --wine: #8e1b2c;
  --accent-grad: linear-gradient(135deg, #e3122d 0%, #9c1830 100%);
  --red-soft: rgba(227, 18, 45, 0.14);
  --ok: #22c55e;
  --warn: #f59e0b;
  --warn-text: #fbbf24;
  --danger: #ef4444;
  --danger-text: #fca5a5;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --glass-blur: saturate(160%) blur(16px);
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #eef0f3;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-2: #f4f5f7;
  --surface-3: #e7e9ee;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #14161a;
  --text-2: #3b4049;
  --muted: #69707c;
  --red-2: #d10f29;
  --red-soft: rgba(227, 18, 45, 0.09);
  --warn-text: #b45309;
  --danger-text: #b91c1c;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.2);
  color-scheme: light;
}

:root {
  --font: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Oswald Variable', 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --topbar-h: 64px;
  --radius: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a {
  color: var(--red-2);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.08;
  margin: 0;
}

p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.glass {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card.pad {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card.pad h2 {
  font-size: 20px;
}

:focus-visible {
  outline: 2px solid var(--red-2);
  outline-offset: 2px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
  min-width: 0;
}

.brand img {
  width: 44px;
  height: auto;
  filter: drop-shadow(0 2px 6px rgba(227, 18, 45, 0.45));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-text small {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-top: 4px;
}

.nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-3);
}

.nav a.active {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(227, 18, 45, 0.35);
}

.nav .icon {
  width: 17px;
  height: 17px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: 600 14px/1 var(--font);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s, filter 0.15s, background 0.15s, box-shadow 0.15s;
  color: var(--text);
  background: var(--surface-2);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 18px rgba(227, 18, 45, 0.3);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface-3);
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.08);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #1fb855 0%, #128c7e 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(18, 140, 126, 0.3);
}

.btn-whatsapp:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.btn-muted {
  background: var(--surface-3);
  color: var(--muted);
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-sm .icon {
  width: 16px;
  height: 16px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.icon-btn.danger:hover {
  color: var(--danger);
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--red-2);
  text-decoration: underline;
  cursor: pointer;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.empty .spinner {
  border-color: var(--border-strong);
  border-top-color: var(--red);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Layout ---------- */
main {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
}

.view {
  position: absolute;
  inset: 0;
}

.view-page {
  overflow: auto;
}

/* ---------- Karte ---------- */
#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

.leaflet-container {
  font-family: var(--font);
  background: var(--bg);
}

/* Dunkle Kartenkacheln aus dem Standard-OSM-Stil */
:root[data-theme='dark'] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.45);
}

:root[data-theme='light'] .leaflet-tile-pane {
  filter: saturate(0.75) contrast(0.95);
}

.leaflet-control-zoom {
  border: 0 !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  background: var(--surface-solid) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface-2) !important;
}

.leaflet-control-attribution {
  background: var(--surface) !important;
  color: var(--muted) !important;
  border-radius: 8px 0 0 0;
  font-size: 11px;
}

.leaflet-control-attribution a {
  color: var(--text-2) !important;
}

.leaflet-bottom.leaflet-right {
  transition: right 0.28s var(--ease);
}

/* Panel (Liste) */
.panel {
  position: absolute;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: 360px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
}

.panel-grip {
  display: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px 8px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.stat strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
}

.stat:first-child strong {
  color: var(--red-2);
}

.stat span {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(227, 18, 45, 0.18);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0;
  box-shadow: none !important;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-2);
  font: 600 12.5px/1 var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip span {
  color: var(--muted);
  font-weight: 500;
}

.chip:hover {
  background: var(--surface-2);
}

.chip.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.chip.active span {
  color: rgba(255, 255, 255, 0.8);
}

.flag {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  vertical-align: -1px;
}

.list-head {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 2px;
}

.regio-list {
  flex: 1;
  overflow-y: auto;
  margin: 0 -8px;
  padding: 0 8px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.regio-item {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px 8px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: none;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.regio-item:hover {
  background: var(--surface-2);
}

.regio-item.active {
  background: var(--red-soft);
  border-color: rgba(227, 18, 45, 0.4);
}

.ri-logo {
  display: grid;
  place-items: center;
  width: 68px;
  height: 42px;
}

.ri-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.ri-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ri-text strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ri-text small {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.ri-wa {
  color: #25d366;
  display: grid;
}

.skeleton {
  height: 56px;
  border-radius: 12px;
  margin: 6px 0;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* Werkzeuge */
.map-tools {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 790;
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  transition: right 0.28s var(--ease);
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: 600 13px/1 var(--font);
  cursor: pointer;
}

.tool-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tool-btn.active {
  background: var(--red-soft);
  color: var(--red-2);
}

.mobile-only {
  display: none !important;
}

.view-map:has(.drawer.open) .map-tools {
  right: 436px;
}

.view-map:has(.drawer.open) .leaflet-bottom.leaflet-right {
  right: 420px;
}

/* Marker */
.regio-marker {
  background: none;
  border: 0;
}

.regio-marker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
  transition: transform 0.18s var(--ease);
  pointer-events: auto;
  user-select: none;
}

.regio-marker:hover img {
  transform: scale(1.35);
}

.regio-marker.active {
  z-index: 10000 !important;
}

.regio-marker.active img {
  transform: scale(1.65);
}

.regio-marker.active::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(227, 18, 45, 0.35), transparent 70%);
  animation: pulse 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.cluster-wrap {
  background: none;
  border: 0;
}

.cluster {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font: 600 15px/1 var(--font-display);
  background: radial-gradient(circle at 32% 28%, #ff5468, #c4122e 58%, #7d1426);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 6px rgba(227, 18, 45, 0.22), 0 6px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s var(--ease);
}

.cluster-wrap:hover .cluster {
  transform: scale(1.1);
}

.regio-tip {
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font: 600 12.5px var(--font);
  padding: 4px 9px;
}

.regio-tip.leaflet-tooltip-top::before {
  border-top-color: var(--surface-solid);
}

.event-marker {
  background: none;
  border: 0;
}

.event-pin {
  width: 44px;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 2px #fff, 0 8px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s var(--ease);
}

.event-pin:hover {
  transform: translateY(-3px) scale(1.06);
}

.event-pin small {
  order: -1;
  width: 100%;
  background: var(--accent-grad);
  color: #fff;
  font: 700 10px/16px var(--font);
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.05em;
}

.event-pin b {
  font: 700 19px/28px var(--font-display);
  color: #14161a;
}

.ks-popup .leaflet-popup-content-wrapper,
.ks-popup .leaflet-popup-tip {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.ks-popup .leaflet-popup-content-wrapper {
  border-radius: 14px;
  border: 1px solid var(--border);
}

.ks-popup .leaflet-popup-content {
  margin: 14px 16px;
}

.ks-popup a.leaflet-popup-close-button {
  color: var(--muted);
}

.event-popup {
  display: grid;
  gap: 6px;
  min-width: 200px;
  font-size: 13px;
}

.event-popup strong {
  font: 600 17px/1.15 var(--font-display);
  text-transform: uppercase;
}

.event-popup span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
}

.event-popup .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.event-popup .btn {
  margin-top: 6px;
  color: #fff;
}

/* Drawer (Regio-Details) */
.drawer {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 400px;
  z-index: 850;
  border-radius: 22px;
  overflow-y: auto;
  transform: translateX(calc(100% + 32px));
  transition: transform 0.3s var(--ease);
  scrollbar-width: thin;
}

.drawer.open {
  transform: none;
}

.drawer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: var(--surface);
  backdrop-filter: blur(8px);
}

.drawer-hero {
  display: grid;
  place-items: center;
  height: 220px;
  padding: 28px;
  background:
    radial-gradient(ellipse at 50% 115%, rgba(227, 18, 45, 0.4), transparent 68%),
    var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.drawer-hero img {
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
  animation: pop 0.45s var(--ease);
}

@keyframes pop {
  from {
    transform: scale(0.85) translateY(8px);
    opacity: 0;
  }
}

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px 22px;
}

.drawer-body h2 {
  font-size: 30px;
  margin-top: -6px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.kpi-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red-2);
}

.kpi strong {
  display: block;
  font: 600 28px/1 var(--font-display);
}

.kpi small {
  color: var(--muted);
  font-size: 12.5px;
}

.drawer-desc {
  color: var(--text-2);
  line-height: 1.6;
  white-space: pre-line;
}

.drawer-sub {
  font-size: 15px;
  color: var(--text-2);
  margin-top: 6px;
}

.mini-events {
  display: grid;
  gap: 8px;
}

.mini-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}

.mini-event:hover {
  border-color: rgba(227, 18, 45, 0.45);
}

.mini-event strong {
  display: block;
  font-size: 14px;
}

.mini-event small {
  color: var(--muted);
  font-size: 12.5px;
}

.drawer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}

.drawer-foot .icon {
  width: 14px;
  height: 14px;
}

.drawer-foot a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-2);
}

/* Datum-Badge */
.date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  color: #14161a;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.date-badge small {
  order: -1;
  width: 100%;
  text-align: center;
  background: var(--accent-grad);
  color: #fff;
  font: 700 10.5px/18px var(--font);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.date-badge b {
  font: 700 22px/32px var(--font-display);
}

.date-badge.sm {
  width: 44px;
}

.date-badge.sm b {
  font-size: 18px;
  line-height: 26px;
}

/* ---------- Seiten (Events, Admin) ---------- */
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: 48px;
  margin: 6px 0 8px;
}

.page-head .eyebrow {
  color: var(--red-2);
}

.page-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.page-tools .search {
  min-width: 260px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.segmented button {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font: 600 13px/1 var(--font);
  cursor: pointer;
}

.segmented button em {
  font-style: normal;
  color: var(--muted);
  margin-left: 4px;
}

.segmented button.active {
  background: var(--accent-grad);
  color: #fff;
}

.segmented button.active em {
  color: rgba(255, 255, 255, 0.8);
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

.event-card {
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
}

.event-card:hover,
.event-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(227, 18, 45, 0.4);
}

.event-card.past {
  opacity: 0.72;
}

.event-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-2);
}

.event-media .bg {
  position: absolute;
  inset: -20px;
  width: calc(100% + 40px);
  height: calc(100% + 40px);
  object-fit: cover;
  filter: blur(22px) saturate(1.3);
  opacity: 0.55;
}

.event-media .fg {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px;
  transition: transform 0.4s var(--ease);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35));
}

.event-card:hover .fg {
  transform: scale(1.04);
}

.flyer-ph {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
}

.flyer-ph .icon {
  width: 36px;
  height: 36px;
  opacity: 0.7;
}

.status-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font: 700 11px/1 var(--font);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: rgba(15, 16, 20, 0.7);
  backdrop-filter: blur(6px);
}

.status-pill.upcoming {
  background: rgba(227, 18, 45, 0.92);
}

.status-pill.running {
  background: #16a34a;
}

.status-pill.past {
  background: rgba(90, 94, 104, 0.9);
}

.status-pill.inline {
  position: static;
  align-self: flex-start;
}

.event-media .date-badge {
  position: absolute;
  top: 12px;
  right: 12px;
}

.event-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding: 16px 18px 18px;
}

.event-body h3 {
  font-size: 23px;
}

.meta {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.meta li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 14px;
}

.meta .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.meta .dur {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.event-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.event-actions .btn-ghost {
  margin-left: auto;
}

/* Event-Detail */
.event-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.event-detail.no-flyer {
  grid-template-columns: 1fr;
}

.flyer-full {
  display: block;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.flyer-full img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.flyer-full.pdf iframe {
  display: block;
  width: 100%;
  height: 68vh;
  border: 0;
  background: #fff;
}

.event-detail-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 12px;
  align-items: baseline;
}

.facts dt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.facts dt .icon {
  width: 15px;
  height: 15px;
}

.facts dd {
  margin: 0;
  font-weight: 500;
}

.facts dd a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.facts dd .icon {
  width: 14px;
  height: 14px;
}

.event-desc {
  white-space: pre-line;
  color: var(--text-2);
  line-height: 1.6;
}

.event-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 56px 16px;
  text-align: center;
  color: var(--muted);
}

.empty .icon {
  width: 40px;
  height: 40px;
  opacity: 0.6;
}

.empty h3 {
  color: var(--text);
  font-size: 22px;
}

.empty.small {
  padding: 24px 12px;
}

.empty.small .icon {
  width: 26px;
  height: 26px;
}

/* ---------- Modal ---------- */
body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 6, 10, 0.62);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s;
}

.modal-backdrop.show {
  opacity: 1;
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100dvh - 48px);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.24s var(--ease);
  outline: none;
}

.modal-backdrop.show .modal {
  transform: none;
}

.modal-sm {
  max-width: 460px;
}

.modal-md {
  max-width: 640px;
}

.modal-lg {
  max-width: 1000px;
}

.modal-xl {
  max-width: 1120px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  font-size: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
}

.confirm-text {
  color: var(--text-2);
  line-height: 1.55;
}

/* ---------- Formulare ---------- */
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 28px;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

form > .field + .field {
  margin-top: 14px;
}

.field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

input,
select,
textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(227, 18, 45, 0.18);
}

textarea {
  height: auto;
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238d939f' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--red);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-row.three {
  grid-template-columns: 1fr 1fr 0.8fr;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.hint.warn {
  color: var(--warn-text);
}

.form-error {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--danger-text);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 150px;
  padding: 16px;
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--red);
  background: var(--red-soft);
}

.dz-preview {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
}

.dz-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.dz-text b {
  color: var(--text);
  font-size: 14px;
}

.dz-text .icon {
  width: 24px;
  height: 24px;
  color: var(--red-2);
  margin-bottom: 2px;
}

.dz-current:empty {
  display: none;
}

.dz-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-3);
  font-size: 13px;
}

/* Kartenauswahl im Formular */
.picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-search {
  position: relative;
}

.picker-results {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  z-index: 1100;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.picker-results button {
  display: flex;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: none;
  color: var(--text);
  font: 13px/1.4 var(--font);
  text-align: left;
  cursor: pointer;
}

.picker-results button:hover {
  background: var(--surface-2);
}

.picker-results .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  margin-top: 1px;
}

.picker-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
}

.picker-map {
  height: 360px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
}

.picker-pin {
  background: none;
  border: 0;
}

.picker-pin .icon {
  width: 34px;
  height: 34px;
  fill: var(--red);
  stroke: #fff;
  stroke-width: 1.6;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}

/* ---------- Admin ---------- */
.admin-login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: radial-gradient(ellipse at 50% -10%, rgba(227, 18, 45, 0.22), transparent 60%);
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card h1 {
  font-size: 30px;
  text-align: center;
}

.login-card > p {
  text-align: center;
  margin-top: -8px;
}

.login-logo {
  display: block;
  width: 200px;
  margin: 0 auto 4px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px;
}

.admin-nav {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 2px 14px;
  border-bottom: 1px solid var(--border);
}

.admin-user strong {
  display: block;
  font-size: 14.5px;
}

.admin-user small {
  color: var(--muted);
  font-size: 12.5px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-grad);
  color: #fff;
  font: 600 16px/1 var(--font-display);
  flex-shrink: 0;
}

.admin-nav nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-nav nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.admin-nav nav a em {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.admin-nav nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.admin-nav nav a.active {
  background: var(--red-soft);
  color: var(--red-2);
}

.admin-nav nav a.active em {
  background: rgba(227, 18, 45, 0.18);
  color: inherit;
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-head h1 {
  font-size: 34px;
}

.admin-head p {
  margin-top: 4px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar .search {
  flex: 1;
  min-width: 220px;
}

.toolbar select {
  width: auto;
  min-width: 210px;
}

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  position: sticky;
  top: 0;
  padding: 12px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tr.clickable {
  cursor: pointer;
}

.table tr.clickable:hover td {
  background: var(--surface-2);
}

.table .num {
  text-align: right;
}

.tbl-logo {
  display: block;
  width: 66px;
  height: 40px;
  object-fit: contain;
}

.tbl-ph {
  display: grid;
  place-items: center;
  width: 66px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
}

.row-actions {
  text-align: right;
  white-space: nowrap;
}

.row-actions .icon-btn {
  width: 34px;
  height: 34px;
  margin-left: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.badge.warn {
  background: rgba(245, 158, 11, 0.16);
  color: var(--warn-text);
}

.ok {
  color: var(--ok);
  display: inline-grid;
  vertical-align: middle;
}

.ok .icon {
  width: 17px;
  height: 17px;
}

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid;
  font-size: 14px;
}

.banner div {
  flex: 1;
}

.banner.warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
}

.banner.warn > .icon {
  color: var(--warn);
}

.konto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 4000;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s var(--ease);
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-info .icon {
  color: var(--ok);
}

.toast-error .icon {
  color: var(--danger);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .admin-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    padding: 20px 16px;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-h: 58px;
  }

  .topbar {
    padding: 0 12px;
    gap: 10px;
  }

  .brand img {
    width: 38px;
  }

  .brand-text strong {
    font-size: 17px;
  }

  .brand-text small {
    display: none;
  }

  .nav a {
    padding: 0 10px;
    height: 34px;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .desktop-only {
    display: none;
  }

  /* Liste als Bottom-Sheet */
  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 68dvh;
    border-radius: 22px 22px 0 0;
    padding: 10px 14px 14px;
    transform: translateY(105%);
    transition: transform 0.3s var(--ease);
    z-index: 860;
  }

  body.panel-open .panel {
    transform: none;
  }

  .panel-grip {
    display: block;
    width: 44px;
    height: 5px;
    margin: 0 auto 2px;
    border-radius: 99px;
    background: var(--border-strong);
  }

  .map-tools {
    top: 12px;
    left: 12px;
    right: auto;
  }

  .view-map:has(.drawer.open) .map-tools {
    right: auto;
  }

  .view-map:has(.drawer.open) .leaflet-bottom.leaflet-right {
    right: 0;
  }

  .drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 74dvh;
    border-radius: 22px 22px 0 0;
    transform: translateY(105%);
    z-index: 900;
  }

  .drawer-hero {
    height: 160px;
  }

  .drawer-hero img {
    max-height: 120px;
  }

  .page {
    padding: 24px 16px 56px;
  }

  .page-head h1 {
    font-size: 36px;
  }

  .page-tools,
  .page-tools .search {
    width: 100%;
    min-width: 0;
  }

  .event-grid {
    grid-template-columns: 1fr;
  }

  .event-detail {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
  }

  .modal-body {
    padding: 18px 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .picker-map {
    height: 280px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
    padding: 14px 12px 48px;
    gap: 14px;
  }

  .admin-nav {
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 8px;
    overflow-x: auto;
  }

  .admin-user {
    display: none;
  }

  .admin-nav nav {
    flex-direction: row;
  }

  .admin-nav nav a span {
    display: none;
  }

  .admin-nav .btn-block {
    width: auto;
    margin-left: auto;
    height: 38px;
  }

  .admin-head h1 {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .nav a span {
    display: none;
  }

  .stat strong {
    font-size: 19px;
  }

  .field-row.three {
    grid-template-columns: 1fr 1fr;
  }

  .field-row.three .field:last-child {
    grid-column: 1 / -1;
  }

  .admin-head .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
