/* Felder & Hof – Karte mit Umriss abstecken (06.11.2026, js/hw-felder-karte.js). Nur wenn hwfAn().
   Aussehen wie die Rollrasen-Demo (vorschau/felder.css der Rollrasen-Demo): ruhige weiße Knöpfe, Felder in der Farbe der Sorte,
   großes Fenster mit schwebender Liste links und dem Feld rechts. */

/* Seite: Feld-Liste links, Karte rechts (schmal untereinander) */
.hwf-oben { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.hwf-oben--ohne { grid-template-columns: minmax(0, 1fr); }
.hwf-oben > .dash-card { margin: 0; }
.hwk-mini { padding: 10px; display: flex; flex-direction: column; min-height: 340px; }
.hwk-mini-flaeche { position: relative; flex: 1 1 auto; min-height: 320px; border-radius: 14px; overflow: hidden; }
.hwk-mini .leaflet-interactive { cursor: pointer; }
.hwk-gross { position: absolute; top: 12px; right: 12px; z-index: 500; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; color: #2b2f33; background: #fff; border: 0; border-radius: 10px; padding: 7px 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .22); }
.hwk-gross:hover { background: #f4f6f8; }
.hwk-mini .leaflet-top.leaflet-right { top: 46px; }
.hwk-mini .leaflet-top.leaflet-right .leaflet-control { margin: 8px 12px 0 0; }
.hwk-mini-leer { position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); z-index: 500; display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 12px; padding: 8px 8px 8px 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); font-size: 13.5px; font-weight: 600;
  color: #2b2f33; white-space: nowrap; }
.hwk-mini-leer.hidden { display: none; }
.hwk-mini-leer .btn-sm, .hwk-knopf { display: inline-flex; align-items: center; gap: 6px; }
.hwk-weit .hwk-form { display: none; }

/* Karte */
.hwk-karte { position: absolute; inset: 0; background: #3d4a38; }   /* dunkles Feldgrün: beim Laden kein heller Blitz */
.hwk-karte.hwk-art-karte { background: #f3f3f0; }
.hwk-karte.hwk-zeichnet { cursor: crosshair; }
.hwk-luft { filter: saturate(.9) brightness(.94) contrast(1.06); }
.hwk-karte .leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, .6); }
.hwk-karte .leaflet-bar { border: 0; border-radius: 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, .22); overflow: hidden; }
.hwk-karte .leaflet-bar a { width: 34px; height: 34px; line-height: 34px; display: flex; align-items: center; justify-content: center; color: #2b2f33; border-bottom-color: #eef1f5; }
.hwk-karte .leaflet-bar a:hover { background: #f4f6f8; color: #111; }
.hwk-karte .leaflet-control-zoom a { font: 600 18px/34px system-ui, sans-serif; }
.hwk-karte .leaflet-top.leaflet-left .leaflet-control { margin: 12px 0 0 12px; }
.hwk-karte .leaflet-top .hwk-kknoepfe { margin-top: 8px; }
.hwk-art { display: flex; background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, .22); padding: 3px; gap: 2px; }
.hwk-art button { font: 600 12px/1 system-ui, sans-serif; color: #475569; background: none; border: 0; border-radius: 7px; padding: 7px 11px; cursor: pointer; }
.hwk-art button:hover { color: #111; }
.hwk-art button.aktiv { background: #2b2f33; color: #fff; }
.hwk-karte .leaflet-bottom.leaflet-left .leaflet-control { margin: 0 0 12px 12px; }
.hwk-karte .leaflet-control-scale-line { border: 2px solid #475569; border-top: 0; background: rgba(255, 255, 255, .8); color: #2b2f33; font: 600 11px/1.4 system-ui, sans-serif; }
.hwk-karte .leaflet-bottom.leaflet-right .leaflet-control-scale { margin: 0 8px 4px 0; }
.hwk-legende { display: none; flex-direction: column; gap: 4px; background: rgba(255, 255, 255, .94); border-radius: 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
  padding: 8px 10px; font: 600 11.5px/1.2 system-ui, sans-serif; color: #2b2f33; margin: 0 8px 8px 0 !important; }
.hwk-legende.hwk-legende--an { display: flex; }
.hwk-legende span { display: flex; align-items: center; gap: 6px; }
.hwk-legende i { width: 10px; height: 10px; border-radius: 3px; }
.hwk-ich-huelle { background: none; border: 0; }
.hwk-ich { display: block; width: 16px; height: 16px; transform: translate(-50%, -50%); border-radius: 50%; background: #2563eb; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, .2), 0 1px 4px rgba(0, 0, 0, .3); }

/* Schilder mit dem Feldnamen */
.hwk-schild-huelle { background: none; border: 0; }
.hwk-schild { display: inline-flex; align-items: center; transform: translate(-50%, -50%); white-space: nowrap; background: rgba(255, 255, 255, .92);
  color: #1f2226; font: 700 12px/1 system-ui, sans-serif; padding: 6px 10px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); cursor: pointer; }
.hwk-schild.aktiv { background: #2b2f33; color: #fff; }
.hwk-pin-punkt { position: absolute; left: 0; top: 0; width: 12px; height: 12px; transform: translate(-50%, -50%); border-radius: 50%; background: #2b2f33;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); box-sizing: border-box; }
.hwk-schild.hwk-schild--pin { position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 11px)); }
.hwk-schild--pin::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: rgba(255, 255, 255, .92); }

/* Großes Fenster */
.dash-live-modal.hwk-fenster { width: min(1440px, calc(94vw / var(--ui-zoom, 1))); max-width: none; height: calc(88vh / var(--ui-zoom, 1)); max-height: none; overflow: hidden; }
.hwk-fenster .dlm-header { gap: 12px; padding: 16px 24px 14px; }
.hwk-fenster .dlm-header > div:first-child { flex: 1 1 auto; min-width: 0; }
.hwk-rumpf { position: relative; flex: 1 1 auto; min-height: 0; border-radius: 0 0 24px 24px; overflow: hidden; }
.hwk-schwebt { position: absolute; z-index: 1100; top: 16px; display: flex; flex-direction: column; background: #fff; border-radius: 16px; overflow: auto;
  box-shadow: 0 4px 20px rgba(15, 23, 42, .2), 0 1px 3px rgba(15, 23, 42, .12); }
.hwk-liste { left: 16px; width: 290px; max-height: calc(100% - 92px); }
.hwk-ort { right: 16px; width: 320px; max-height: calc(100% - 76px); }
.hwk-rumpf:has(.hwk-leiste:not(.hidden)) .hwk-schwebt { display: none; }
.hwk-fenster .leaflet-top.leaflet-left { left: 306px; }
.hwk-rumpf:has(.hwk-leiste:not(.hidden)) .leaflet-top.leaflet-left { left: 0; top: auto; bottom: 58px; }
.hwk-fenster .hwk-legende { display: none !important; }   /* die Sorte steht rechts beim Feld */
.hwk-feld { display: flex; align-items: center; gap: 12px; width: 100%; flex: 0 0 auto; padding: 11px 18px; border: 0; background: none; text-align: left;
  cursor: pointer; font: inherit; color: inherit; transition: background .15s; }
.hwk-feld + .hwk-feld { border-top: 1px solid #edf0f3; }
.hwk-feld:hover { background: #f6f7f9; }
.hwk-feld.aktiv { background: #f1f5f9; box-shadow: inset 3px 0 0 #2b2f33; }
.hwk-feld > i { flex: 0 0 6px; width: 6px; height: 28px; border-radius: 3px; }
.hwk-feld-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hwk-feld-text b { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hwk-feld-text small { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hwk-ort-kopf { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px 2px; min-width: 0; }
.hwk-ort-kopf b { font-size: 16px; font-weight: 650; }
.hwk-ort-kopf small { font-size: 13px; color: var(--text-muted); }
.hwk-sorten { padding: 6px 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.hwk-zahl-gross { font-size: 30px; font-weight: 700; line-height: 1.1; margin-bottom: 4px; color: #1f2226; }
.hwk-sorte { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.hwk-sorte i, .hwk-wahl i { display: block; width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
i.hwk-grau { background: #cbd5e1; }
.hwk-hinweis { font-size: 13px; color: var(--text-muted); }
.hwk-knoepfe { position: absolute; z-index: 500; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.hwk-knoepfe.hidden { display: none; }
.hwk-knoepfe .hwk-knopf { background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }

/* Leiste beim Abstecken und Bearbeiten */
.hwk-leiste { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 1200; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fff; border-radius: 14px; padding: 8px 10px 8px 16px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
.hwk-leiste.hidden { display: none; }
.hwk-leiste-text { flex: 1 1 auto; font-size: 15px; font-weight: 700; color: #1f2226; }
.hwk-leiste .btn-sm[disabled] { opacity: .4; pointer-events: none; }
.hwk-name { flex: 0 1 240px; font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: #1f2226; }
.hwk-name.hwk-fehlt { border-color: #2b2f33; box-shadow: 0 0 0 1px #2b2f33; }
.hwk-wahlen { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 auto; }
.hwk-wahl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; background: #fff; color: #1f2226; }
.hwk-wahl input { position: absolute; opacity: 0; pointer-events: none; }
.hwk-wahl:has(input:checked), .hwk-wahl.hwk-wahl--an { border-color: #2b2f33; box-shadow: 0 0 0 1px #2b2f33; }
.hwk-wahl:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.hwk-ecke { background: #fff; border: 2.5px solid #2b2f33; border-radius: 50%; box-sizing: border-box; cursor: grab; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.hwk-ecke:active { cursor: grabbing; }
.hwk-popup-huelle .leaflet-popup-content { margin: 10px 12px; }
.hwk-popup { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.hwk-popup > span { color: var(--text-muted); margin-bottom: 4px; }
.hwk-popup-wahl { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 8px; width: 250px; }
.hwk-popup-wahl .hwk-wahl { font: inherit; font-size: 12.5px; font-weight: 600; padding: 3px 9px; }

@media (max-width: 1100px) {
  .hwf-oben { grid-template-columns: minmax(0, 1fr); }
  .hwk-liste { width: 230px; }
  .hwk-fenster .leaflet-top.leaflet-left { left: 246px; }
  .hwk-ort { width: 260px; }
}
@media (max-width: 760px) {
  .hwk-mini-flaeche { min-height: 260px; }
  .dash-live-modal.hwk-fenster { width: 100vw; height: 100dvh; border-radius: 0; }
  .hwk-rumpf { border-radius: 0; }
  .hwk-liste { display: none; }
  .hwk-fenster .leaflet-top.leaflet-left { left: 0; }
  .hwk-ort { left: 12px; right: 12px; top: auto; bottom: 64px; width: auto; max-height: 40%; }
}
@media (max-height: 800px) {
  .hwk-fenster .dlm-header { padding: 12px 20px 10px; }
  .hwk-feld { padding: 8px 14px; }
  .hwk-zahl-gross { font-size: 26px; }
}

/* Dunkel: schwebende Karten wie die übrigen Fenster, Kartenknöpfe bleiben hell (wie bei Kartendiensten) */
html.dark .hwk-schwebt, html.dark .hwk-leiste { background: var(--white); }
html.dark .hwk-feld + .hwk-feld { border-top-color: var(--border); }
html.dark .hwk-feld:hover, html.dark .hwk-feld.aktiv { background: rgba(255, 255, 255, .06); }
html.dark .hwk-feld.aktiv { box-shadow: inset 3px 0 0 var(--text); }
html.dark .hwk-zahl-gross, html.dark .hwk-leiste-text { color: var(--text); }
html.dark .hwk-name, html.dark .hwk-wahl { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .12); color: var(--text); }
html.dark .hwk-wahl:has(input:checked), html.dark .hwk-wahl.hwk-wahl--an { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
html.dark .hwk-popup-huelle .leaflet-popup-content-wrapper, html.dark .hwk-popup-huelle .leaflet-popup-tip { background: var(--white); color: var(--text); }
