/* ==========================================================================
   Vertriebsgebiete-Karte (www.testboy.de/kontakt/), 2026-10-16
   Konzept: Messgeraet. PLZ-Eingabe als LCD mit unbeleuchteten 88888-Segmenten, Karte auf feinem Messraster,
   gewaehltes Gebiet hervorgehoben, die anderen treten zurueck. Schrift und Farben aus dem Website-CI,
   Gebietsfarben aus kontakte.json (Palette-Validator: alle Paare bestanden; Gebiete zusaetzlich direkt beschriftet).
   ========================================================================== */
.tbKarte {
    --k-blau: #009DE2;
    --k-tief: #0B4F7A;
    --k-nacht: #1B2733;
    --k-lcd: #0E1820;
    --k-grau: #6B7885;
    --k-linie: #E3E8EE;
    --k-flaeche: #F7FAFC;
    --k-hoehe: 680px;
    position: relative;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas: "suche karte" "ebenen karte" "quelle legende";
    height: var(--k-hoehe);
    margin-top: 6px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(27, 39, 51, .06), 0 14px 40px rgba(27, 39, 51, .09);
    overflow: hidden;
    text-align: left;
    color: #303030;
}
.tbKarte::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    height: 4px;
    background: linear-gradient(90deg, var(--k-blau), var(--k-tief));
    pointer-events: none;
}
.tbKarte *, .tbKarte *::before, .tbKarte *::after { box-sizing: border-box; }
.tbKarte button { font: inherit; }

/* ---------- Suche ---------- */
.tbK-suche { grid-area: suche; padding: 26px 24px 18px; border-right: 1px solid var(--k-linie); }
.tbK-etikett { display: block; margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--k-grau); }
.tbK-lcd {
    position: relative;
    display: flex;
    align-items: center;
    height: 74px;
    padding: 0 18px;
    border-radius: 10px;
    /* helles, reflektierendes Messgeraete-LCD (Olivers Wunsch: die dunkle Fassung war zu dunkel) */
    background:
        radial-gradient(120% 160% at 100% 0%, rgba(0, 157, 226, .10), transparent 60%),
        linear-gradient(180deg, #F3F8FB, #DFEAF1);
    box-shadow: inset 0 0 0 1px #C6D4DE, inset 0 2px 6px rgba(27, 39, 51, .08);
    cursor: text;
}
.tbK-lcd small {
    position: absolute;
    top: 9px;
    right: 14px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    color: var(--k-blau);
}
.tbK-lcd .tbK-geist,
.tbK-lcd input {
    font-size: 38px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .32em;
    line-height: 1;
}
.tbK-geist { position: absolute; left: 18px; color: rgba(27, 39, 51, .06); pointer-events: none; user-select: none; }
.tbK-lcd input {
    position: relative;
    width: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--k-nacht);
    text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
    caret-color: var(--k-blau);
}
.tbK-lcd input::placeholder { color: transparent; text-shadow: none; }
.tbK-lcd:focus-within { box-shadow: inset 0 0 0 1px var(--k-blau), 0 0 0 4px rgba(0, 157, 226, .16), inset 0 2px 6px rgba(27, 39, 51, .08); }

/* Ergebnis als Visitenkarte */
.tbK-ergebnis { min-height: 22px; margin-top: 14px; }
.tbK-hinweis { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--k-grau); }
.tbK-zentrale-info { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--k-linie); font-size: 13px; line-height: 1.45; color: var(--k-grau); }
.tbK-zentrale-info i { margin-right: 4px; color: var(--k-blau); }
.tbK-zentrale-info a { font-weight: 700; color: var(--k-nacht); white-space: nowrap; }
.tbK-karte-person {
    position: relative;
    padding: 14px 16px 15px 18px;
    border-radius: 10px;
    background: var(--k-flaeche);
    box-shadow: inset 0 0 0 1px var(--k-linie);
    animation: tbK-auf .28s cubic-bezier(.2, .8, .2, 1);
}
.tbK-karte-person::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 3px 3px 0; background: var(--k-farbe, var(--k-blau)); }
.tbK-karte-person .tbK-region { display: block; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--k-grau); }
.tbK-karte-person .tbK-name { display: block; margin: 2px 0 10px; font-size: 20px; font-weight: 700; line-height: 1.2; color: var(--k-nacht); }
.tbK-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; }
.tbKarte a.tbK-knopf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    color: #fff;
    background: var(--k-blau);
    transition: background-color .2s ease, transform .2s ease;
}
.tbKarte a.tbK-knopf:hover { background: var(--k-tief); transform: translateY(-1px); }
.tbKarte a.tbK-knopf--zweit { color: var(--k-nacht); background: #fff; box-shadow: inset 0 0 0 1px var(--k-linie); }
.tbKarte a.tbK-knopf--zweit:hover { color: var(--k-blau); background: #fff; box-shadow: inset 0 0 0 1px var(--k-blau); }
.tbK-karte-person .tbK-notiz { margin: 10px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--k-grau); }
@keyframes tbK-auf { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Legende unter der Karte: Gebiete als Schaltflaechen ---------- */
.tbK-legende { grid-area: legende; padding: 12px 16px; border-top: 1px solid var(--k-linie); background: #fff; }
.tbK-legende ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
/* Eintrag = Pille aus Schaltflaeche (Gebiet zeigen) + Telefon- und E-Mail-Symbol */
.tbK-legende li {
    display: flex;
    align-items: center;
    padding-right: 5px;
    border-radius: 999px;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--k-linie);
    transition: box-shadow .2s ease, background-color .2s ease;
}
.tbK-legende li:hover { box-shadow: inset 0 0 0 1px #C9D3DC; }
.tbK-legende li.ist-aktiv { background: var(--k-flaeche); box-shadow: inset 0 0 0 2px var(--k-farbe, #9AA7B4); }
.tbK-eintrag {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px 7px 10px;
    border: 0;
    border-radius: 999px 0 0 999px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.tbK-eintrag:focus-visible { outline: 2px solid var(--k-blau); outline-offset: -2px; }
.tbKarte a.tbK-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 12.5px;
    color: var(--k-grau);
    text-decoration: none;
    transition: color .2s ease, background-color .2s ease;
}
.tbKarte a.tbK-mini:hover, .tbKarte a.tbK-mini:focus-visible { color: #fff; background: var(--k-blau); outline: 0; }
.tbK-chip { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--k-farbe); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.tbK-chip--export { border-radius: 3px; background: repeating-linear-gradient(45deg, #9AA7B4 0 3px, #D5DCE3 3px 6px); }
.tbK-eintrag b { display: block; font-size: 13.5px; font-weight: 700; line-height: 1.2; color: var(--k-nacht); white-space: nowrap; }
.tbK-eintrag small { display: block; font-size: 11.5px; line-height: 1.2; color: var(--k-grau); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Kartenebenen (Schalter) ---------- */
.tbK-ebenen { grid-area: ebenen; padding: 14px 24px; border-top: 1px solid var(--k-linie); border-right: 1px solid var(--k-linie); }
.tbK-schalter { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; align-items: start; cursor: pointer; }
.tbK-schalter + .tbK-schalter { margin-top: 12px; }
.tbK-schalter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tbK-schalter i {
    position: relative;
    width: 38px;
    height: 22px;
    margin-top: 1px;
    border-radius: 999px;
    background: #CBD5DE;
    transition: background-color .2s ease;
}
.tbK-schalter i::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .22s cubic-bezier(.3, 1.4, .5, 1);
}
.tbK-schalter input:checked + i { background: var(--k-blau); }
.tbK-schalter input:checked + i::after { transform: translateX(16px); }
.tbK-schalter input:focus-visible + i { box-shadow: 0 0 0 3px rgba(0, 157, 226, .3); }
.tbK-schalter.laedt i { background: repeating-linear-gradient(90deg, #CBD5DE 0 6px, #DCE4EA 6px 12px); animation: tbK-laden .6s linear infinite; }
@keyframes tbK-laden { to { background-position: 12px 0; } }
.tbK-schalter b { display: block; font-size: 14px; font-weight: 700; color: var(--k-nacht); }
.tbK-schalter small { display: block; font-size: 12px; line-height: 1.35; color: var(--k-grau); }

.tbK-quelle { grid-area: quelle; padding: 10px 24px 14px; border-right: 1px solid var(--k-linie); font-size: 11px; line-height: 1.45; color: #8C97A2; }
.tbK-quelle a { color: inherit; }

/* ---------- Karte ---------- */
.tbK-karte {
    grid-area: karte;
    position: relative;
    min-height: 0;
    background-color: #F3F6F8;
    background-image:
        linear-gradient(rgba(27, 39, 51, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(27, 39, 51, .05) 1px, transparent 1px),
        linear-gradient(rgba(27, 39, 51, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(27, 39, 51, .025) 1px, transparent 1px);
    background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
}
.tbK-karte .leaflet-container { position: absolute; inset: 0; background: transparent; font-family: inherit; }
.tbK-karte.mit-osm .leaflet-container { background: #F3F6F8; }
.tbK-laden { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; font-weight: 500; color: var(--k-grau); }
.tbK-laden::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--k-linie); border-top-color: var(--k-blau); animation: tbK-dreh .8s linear infinite; }
@keyframes tbK-dreh { to { transform: rotate(360deg); } }
.tbK-karte .leaflet-overlay-pane svg path.tbK-flaeche { transition: fill-opacity .25s ease; }

/* Beschriftungen auf der Karte */
.tbK-marke { width: 0 !important; height: 0 !important; }
.tbK-schild {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 11px 6px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 2px 10px rgba(27, 39, 51, .16);
    white-space: nowrap;
    pointer-events: none;
    transition: opacity .25s ease;
}
.tbK-schild::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--k-farbe); }
.tbK-schild span { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--k-grau); }
.tbK-schild b { font-size: 13px; font-weight: 700; color: var(--k-nacht); }
.tbK-schild b { display: none; }
.zeige-namen .tbK-schild b { display: inline; }
.tbK-karte.hat-fokus .tbK-schild { opacity: .35; }
.tbK-karte.hat-fokus .tbK-schild.ist-aktiv { opacity: 1; }
.tbK-stadt i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--k-nacht); box-shadow: 0 0 0 1.5px #fff; }
.tbK-stadt span { position: absolute; left: 7px; top: -8px; font-size: 11.5px; font-weight: 500; color: var(--k-nacht); white-space: nowrap; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
.tbK-stadt.e2, .tbK-stadt.e3 { display: none; }
.zeige-e2 .tbK-stadt.e2, .zeige-e3 .tbK-stadt.e3 { display: block; }
.tbK-land span { position: absolute; transform: translate(-50%, -50%); font-size: 11px; font-weight: 500; font-style: italic; letter-spacing: .24em; text-transform: uppercase; color: #9AA7B4; white-space: nowrap; }
.tbK-land.meer span { color: #86AFCB; letter-spacing: .32em; }
.mit-osm .tbK-stadt, .mit-osm .tbK-land { display: none !important; }
.tbK-zentrale i { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; transform: rotate(45deg); border-radius: 2px; background: var(--k-blau); box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, .3); }
.tbK-zentrale span { position: absolute; right: 13px; top: -10px; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: #fff; background: var(--k-nacht); white-space: nowrap; }
.tbK-plzschild span { position: absolute; transform: translate(-50%, -50%); font-size: 10.5px; font-weight: 700; color: var(--k-nacht); font-variant-numeric: tabular-nums; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; white-space: nowrap; }
.tbK-nadel b { position: absolute; left: -12px; top: -34px; width: 24px; height: 24px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--k-nacht); box-shadow: inset 0 0 0 4px var(--k-blau), 0 4px 10px rgba(0, 0, 0, .3); animation: tbK-fall .4s cubic-bezier(.3, 1.6, .6, 1); }
.tbK-nadel span { position: absolute; left: 16px; top: -34px; padding: 3px 9px; border-radius: 5px; font-size: 13px; font-weight: 700; letter-spacing: .06em; color: #8FDBFA; background: var(--k-lcd); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbK-nadel i { position: absolute; left: -14px; top: -7px; width: 28px; height: 14px; border-radius: 50%; background: rgba(27, 39, 51, .25); animation: tbK-puls 1.6s ease-out infinite; }
@keyframes tbK-fall { from { opacity: 0; transform: translateY(-26px) rotate(-45deg); } to { opacity: 1; transform: rotate(-45deg); } }
@keyframes tbK-puls { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
.tbK-tipp { padding: 6px 10px; border: 0; border-radius: 8px; background: var(--k-nacht); color: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); font-size: 13px; font-weight: 700; }
.tbK-tipp::before { display: none; }
.tbK-tipp small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8FDBFA; }

/* Leaflet-Bedienelemente im CI */
.tbK-karte .leaflet-bar { border: 0; border-radius: 9px; box-shadow: 0 2px 10px rgba(27, 39, 51, .16); overflow: hidden; }
.tbK-karte .leaflet-bar a { width: 34px; height: 34px; line-height: 34px; color: var(--k-nacht); border-bottom-color: var(--k-linie); }
.tbK-karte .leaflet-bar a:hover { color: var(--k-blau); background: #fff; }
.tbK-gesamt { padding: 8px 13px; border: 0; border-radius: 9px; background: #fff; box-shadow: 0 2px 10px rgba(27, 39, 51, .16); font-size: 12.5px !important; font-weight: 700; color: var(--k-nacht); cursor: pointer; }
.tbK-gesamt:hover { color: var(--k-blau); }
.tbK-karte .leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, .8); border-top-left-radius: 6px; }

/* ---------- Tablet und Handy: Suche, Karte, Liste untereinander ---------- */
@media (max-width: 991px) {
    .tbKarte { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "suche" "karte" "legende" "ebenen" "quelle"; height: auto; }
    .tbK-suche, .tbK-ebenen, .tbK-quelle { border-right: 0; }
    .tbK-karte { height: min(70vh, 560px); min-height: 380px; border-top: 1px solid var(--k-linie); border-bottom: 1px solid var(--k-linie); }
    .tbK-legende { border-top: 0; padding: 14px 24px 4px; }
}
@media (max-width: 575px) {
    .tbK-suche { padding: 22px 16px 16px; }
    .tbK-legende, .tbK-ebenen, .tbK-quelle { padding-left: 16px; padding-right: 16px; }
    .tbK-lcd .tbK-geist, .tbK-lcd input { font-size: 34px; }
    .tbK-zentrale span { right: auto; left: 13px; }
    .tbK-schild b { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .tbKarte *, .tbKarte *::before, .tbKarte *::after { animation: none !important; transition: none !important; }
}
