/* Besucher: Kennzahlen, Saeulen, Besuche mit Weg, Ranglisten. Baut auf
   .kpis/.kpi, .segment und .home-karte aus home.css auf. Eine Reihe pro
   Diagramm, ein Farbton (Papier), Werte beim Hover/Fokus. */
.bs-admin { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 1120px; }
.bs-hinweis { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.bs-leise { color: var(--faint); }
.bs-kopfzeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bs-stand { font-size: 12px; }
.bs-fuss { font-size: 12px; color: var(--faint); }

.bs-live { display: inline-flex; align-items: center; gap: 6px; color: var(--paper); }
.bs-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(127, 158, 130, 0.6); animation: bs-puls 2s infinite; }
@keyframes bs-puls { 70% { box-shadow: 0 0 0 7px rgba(127, 158, 130, 0); } 100% { box-shadow: 0 0 0 0 rgba(127, 158, 130, 0); } }
@media (prefers-reduced-motion: reduce) { .bs-live i { animation: none; } }

/* Saeulen */
.bs-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.bs-chart { margin: 0; min-width: 0; }
.bs-chart figcaption { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.bs-chart__flaeche { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--line2); }
.bs-chart__spalte { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; outline: none; cursor: default; }
.bs-chart__spalte i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: rgba(242, 239, 231, 0.72); }
.bs-chart__spalte:hover i, .bs-chart__spalte:focus-visible i { background: var(--paper); }
.bs-chart__spalte:hover::after, .bs-chart__spalte:focus-visible::after {
  content: attr(data-tipp); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  z-index: 3; padding: 6px 9px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel3);
  color: var(--paper); font-size: 12px; white-space: nowrap; pointer-events: none;
}
.bs-chart__spalte:first-child::after { left: 0; transform: none; }
.bs-chart__spalte:last-child::after { left: auto; right: 0; transform: none; }
.bs-chart__achse { display: flex; gap: 2px; margin-top: 6px; }
.bs-chart__achse span { flex: 1 1 0; min-width: 0; overflow: visible; white-space: nowrap; color: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }

/* Besuche */
.bs-liste__kopf, .bs-home__kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.bs-liste__kopf h3, .bs-home__kopf h3 { margin: 0; }
.bs-filter { flex-wrap: wrap; max-width: 100%; }
.home-karte { min-width: 0; }
.bs-liste { list-style: none; margin: 0; padding: 0; }
.bs-sitzung { border-top: 1px solid var(--line); }
.bs-sitzung:first-child { border-top: 0; }
.bs-sitzung__kopf {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; width: 100%; min-height: 64px;
  padding: 10px 2px; border: 0; background: none; color: var(--paper); font: inherit; text-align: left; cursor: pointer;
}
.bs-sitzung__kopf:hover { background: var(--panel2); }
.bs-sitzung__kopf:focus-visible { outline: 2px solid var(--line2); outline-offset: -2px; }
.bs-sitzung__wer { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-sitzung__wann { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bs-sitzung__was, .bs-sitzung__zahlen { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.bs-sitzung__zahlen { text-align: right; white-space: nowrap; }
.bs-sitzung__chips { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.bs-sitzung__chips:empty { display: none; }
.bs-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--panel3); color: var(--muted); font-size: 11px; font-weight: 600; }
.bs-chip--gut { background: rgba(127, 158, 130, 0.16); color: #a9c7ac; }
.bs-sitzung.is-offen .bs-sitzung__kopf { background: var(--panel2); }
.bs-sitzung__detail { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 16px; padding: 12px 2px 18px; }

.bs-fakten { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; align-content: start; }
.bs-fakten dt { color: var(--muted); }
.bs-fakten dd { margin: 0; overflow-wrap: anywhere; }

.bs-weg { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 1px solid var(--line2); display: grid; gap: 2px; }
.bs-schritt { position: relative; display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 6px 0; font-size: 13px; }
.bs-schritt::before { content: ""; position: absolute; left: -18px; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.bs-schritt--warenkorb_rein::before, .bs-schritt--anfrage::before { background: var(--ok); }
.bs-schritt time { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.bs-schritt__text { min-width: 0; overflow-wrap: anywhere; }
.bs-schritt__text a { color: var(--paper); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.bs-schritt__art { display: inline-block; min-width: 86px; margin-right: 6px; color: var(--muted); font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; }
.bs-schritt__art--gut { color: #a9c7ac; }
.bs-schritt__dauer { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Top-Artikel */
.bs-tabelle { overflow-x: auto; }
.bs-tabelle table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bs-tabelle th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.bs-tabelle td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.bs-tabelle th:not(:first-child), .bs-tabelle td:not(:first-child) { text-align: right; white-space: nowrap; }
.bs-tabelle td a { color: var(--paper); text-decoration: none; }
.bs-tabelle td a:hover { text-decoration: underline; }
.bs-top .bs-hinweis { font-size: 12px; margin-bottom: 8px; }

/* Ranglisten */
.bs-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.bs-rang ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bs-rang li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; }
.bs-rang__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-rang__wert { color: var(--muted); font-variant-numeric: tabular-nums; }
.bs-rang__balken { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--panel3); overflow: hidden; }
.bs-rang__balken i { display: block; height: 100%; border-radius: 4px; background: rgba(242, 239, 231, 0.72); }

/* Uebersicht-Karte */
.bs-home__kopf .text-btn { font-size: 13px; min-height: 36px; }
.bs-home__zahlen { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.bs-home__zahlen strong { color: var(--paper); font-size: 22px; font-weight: 800; margin-right: 4px; font-variant-numeric: tabular-nums; }
.bs-liste--kurz .bs-kurz { display: grid; gap: 2px; padding: 9px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.bs-liste--kurz .bs-kurz:first-child { border-top: 0; }
.bs-liste--kurz .bs-kurz span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-liste--kurz .bs-leise { font-size: 12px; font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .bs-tabelle th:nth-child(3), .bs-tabelle td:nth-child(3) { display: none; }
  .bs-tabelle table { table-layout: fixed; }
  .bs-tabelle th:first-child { width: 46%; }
  .bs-tabelle td:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bs-tabelle th, .bs-tabelle td { padding-right: 6px; }
  .bs-sitzung__detail { grid-template-columns: 1fr; }
  .bs-schritt { grid-template-columns: 58px minmax(0, 1fr); }
  .bs-schritt__dauer { grid-column: 2; }
  .bs-schritt__art { min-width: 0; display: block; margin: 0 0 2px; }
  .bs-sitzung__zahlen { grid-column: 1 / -1; text-align: left; }
  .bs-sitzung__wann { grid-row: 1; grid-column: 2; }
}

/* Herkunft steht direkt unter den Kennzahlen, auch auf dem Handy. */
.bs-herkunft h3 { margin: 0 0 8px; }
.bs-herkunft caption { text-align: left; padding: 0 0 12px; caption-side: bottom; }
.bs-herkunft__erklaerung { margin-top: 14px; max-width: 78ch; }
.bs-herkunft__filter { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; font-size: 13px; }
.bs-herkunft__filter select { max-width: 100%; padding: 9px 12px; background: var(--panel3); color: var(--paper); border: 1px solid var(--line2); border-radius: 7px; font: inherit; }
.bs-herkunft__filter select:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }

.bs-herkunft table { min-width: 620px; }
.bs-herkunft th:first-child, .bs-herkunft td:first-child { min-width: 160px; }
.bs-herkunft .bs-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bs-herkunft .bs-tabelle:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }

.bs-dokumentation summary { cursor: pointer; font-weight: 650; }
.bs-dokumentation p { max-width: 85ch; font-size: 13px; line-height: 1.6; color: var(--muted); }
.bs-dokumentation .btn { margin-top: 14px; }

/* Weltkarte (ganz oben in "Besucher"): ein Farbton (Papier) in fuenf Stufen,
   Laender ohne Besuch als dunkle Silhouette, Besucher als helle Punkte mit
   dunklem Rand (Groesse = Anzahl), gesperrte Versuche als rote Punkte
   (--danger). Rechts daneben die Laenderliste, am Handy darunter. */
.bs-karte__kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bs-karte__kopf h3 { margin: 0 0 2px; }
.bs-karte__inhalt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); gap: 18px; align-items: start; }
.bs-karte__links, .bs-karte__seite { min-width: 0; }
.bs-karte__flaeche { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.bs-karte__flaeche svg { display: block; width: 100%; height: auto; max-height: 460px; }
/* Gezoomt: Finger und Maus verschieben die Karte (die Seite scrollt ausserhalb der Karte). */
.bs-karte__flaeche.is-zoom { touch-action: none; cursor: grab; }
.bs-karte__flaeche.is-ziehen, .bs-karte__flaeche.is-ziehen path.bs-land[data-bs-land] { cursor: grabbing; }
.bs-karte__zoom { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 6px; }
.bs-karte__zoom button { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line2, var(--line)); border-radius: 8px; background: rgba(18, 18, 18, 0.82); color: var(--paper); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.bs-karte__zoom button:hover:not(:disabled), .bs-karte__zoom button:focus-visible { border-color: var(--paper); }
.bs-karte__zoom button:disabled { opacity: 0.35; cursor: default; }
.bs-land { fill: rgba(242, 239, 231, 0.1); stroke: rgba(242, 239, 231, 0.22); stroke-width: 0.6px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.bs-land--s1 { fill: rgba(242, 239, 231, 0.26); }
.bs-land--s2 { fill: rgba(242, 239, 231, 0.4); }
.bs-land--s3 { fill: rgba(242, 239, 231, 0.55); }
.bs-land--s4 { fill: rgba(242, 239, 231, 0.72); }
.bs-land--s5 { fill: rgba(242, 239, 231, 0.9); }
path.bs-land[data-bs-land], .bs-landpunkt[data-bs-land] { cursor: pointer; outline: none; }
path.bs-land[data-bs-land]:hover, path.bs-land[data-bs-land]:focus-visible { stroke: var(--paper); stroke-width: 1.6px; }
.bs-landpunkt { fill: var(--paper); stroke: var(--bg); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.bs-landpunkt[data-bs-land]:hover, .bs-landpunkt[data-bs-land]:focus-visible { stroke: var(--ok); stroke-width: 2.5px; }
.bs-sperrpunkt { fill: rgba(189, 107, 99, 0.45); stroke: var(--danger); stroke-width: 1.2px; vector-effect: non-scaling-stroke; pointer-events: visiblePainted; }
.bs-karte__info { min-height: 1.5em; margin-top: 8px; color: var(--paper); }
.bs-karte__legende { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; }
.bs-karte__stufen { display: inline-flex; gap: 2px; }
.bs-karte__stufen i { display: block; width: 22px; height: 10px; border-radius: 2px; }
.bs-karte__stufen i.bs-land--s1 { background: rgba(242, 239, 231, 0.26); }
.bs-karte__stufen i.bs-land--s2 { background: rgba(242, 239, 231, 0.4); }
.bs-karte__stufen i.bs-land--s3 { background: rgba(242, 239, 231, 0.55); }
.bs-karte__stufen i.bs-land--s4 { background: rgba(242, 239, 231, 0.72); }
.bs-karte__stufen i.bs-land--s5 { background: rgba(242, 239, 231, 0.9); }
.bs-karte__gruppe { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.bs-karte__punktzeichen { display: inline-block; width: 10px; height: 10px; margin-left: 4px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 2.5px var(--line2); }
.bs-karte__sperrschalter { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); cursor: pointer; }
.bs-karte__sperrschalter input { accent-color: var(--danger); }
.bs-karte__sperrzeichen { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: rgba(189, 107, 99, 0.45); border: 1px solid var(--danger); }
.bs-karte__listentitel { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.bs-karte__liste { list-style: none; margin: 0 0 8px; padding: 0 4px 0 0; max-height: 420px; overflow-y: auto; font-size: 13px; }
.bs-karte__liste li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.bs-karte__land { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-karte__zahl { text-align: right; white-space: nowrap; }
.bs-karte__balken { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.bs-karte__balken i { display: block; height: 100%; border-radius: 2px; background: rgba(242, 239, 231, 0.72); }
@media (max-width: 900px) {
  .bs-karte__inhalt { grid-template-columns: minmax(0, 1fr); }
  .bs-karte__liste { max-height: 264px; }
}

/* Mini-Karte auf der Uebersicht ("Besucher heute"). */
.bs-home__karte { display: block; width: 100%; margin: 4px 0 8px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; cursor: pointer; }
.bs-home__karte:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.bs-home__karte svg { display: block; width: 100%; height: auto; max-height: 220px; }
.bs-home__laender { margin-bottom: 6px; }

/* Sicherheit (Waechter-Sperren) */
.bs-sicherheit h3 { margin: 0; }
.bs-sicherheit table { min-width: 680px; }
.bs-sicherheit .bs-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bs-sicherheit__grund code { color: var(--faint); font-size: 11px; overflow-wrap: anywhere; }
.bs-sicherheit td:last-child { white-space: nowrap; }
.bs-sicherheit .btn { margin-left: 6px; }
.bs-chip--warn { background: rgba(189, 107, 99, 0.18); color: #e0a39c; }
.bs-sicherheit__kpis { margin: 12px 0; }
.bs-sicherheit__badges { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.bs-sicherheit__nr { font-size: 11px; font-variant-numeric: tabular-nums; }
.bs-kampagnen { margin: 14px 0; }
.bs-kampagnen__liste { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.bs-kampagne { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 10px; font-size: 13px; overflow-wrap: anywhere; }
.bs-kampagne.is-aktiv { border-color: var(--danger); }
.bs-kampagne code { color: var(--paper); font-size: 12px; }
.bs-kampagne .bs-chip { justify-self: start; }
.bs-vorschau { margin: 16px 0 8px; display: grid; gap: 6px; }
.bs-vorschau a { color: var(--paper); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; }
.bs-sicherheit .bs-tabelle th:nth-child(-n+4), .bs-sicherheit .bs-tabelle td:nth-child(-n+4) { text-align: left; }
.bs-sicherheit .bs-tabelle td:nth-child(3) { white-space: normal; min-width: 220px; }
@media (max-width: 640px) {
  .bs-karte__sperrschalter { margin-left: 0; }
}
