/* exploreIQ — gemeinsame Tokens und Komponenten.
   Helles Standarddesign; Dark Mode folgt der Systemeinstellung. */

  :root {
    color-scheme: light;
    --plane:        #f9f9f7;
    --surface:      #fcfcfb;
    --ink:          #0b0b0b;
    --ink-2:        #52514e;
    --ink-muted:    #898781;
    --grid:         #e1e0d9;
    --baseline:     #c3c2b7;
    --border:       rgba(11, 11, 11, 0.10);
    --accent:       #2a78d6;
    --accent-soft:  #cde2fb;
    --good:         #0ca30c;
    --warning:      #fab219;
    --critical:     #d03b3b;
    --radius:       10px;
  }
  @media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) {
      color-scheme: dark;
      --plane:       #0d0d0d;
      --surface:     #1a1a19;
      --ink:         #ffffff;
      --ink-2:       #c3c2b7;
      --ink-muted:   #898781;
      --grid:        #2c2c2a;
      --baseline:    #383835;
      --border:      rgba(255, 255, 255, 0.10);
      --accent:      #3987e5;
      --accent-soft: #184f95;
    }
  }

  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--plane);
    color: var(--ink);
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  .wrap { max-width: 1140px; margin: 0 auto; padding: 32px 24px 64px; }

  /* ---------- Kopf ---------- */
  header { margin-bottom: 24px; }
  h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
  .sub { color: var(--ink-2); margin: 0; }
  .snapshot {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 12px; padding: 6px 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; font-size: 13px; color: var(--ink-2);
  }
  .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); flex: none; }
  .dot.ok       { background: var(--good); }
  .dot.warn     { background: var(--warning); }
  .dot.critical { background: var(--critical); }

  /* ---------- Filterzeile ---------- */
  .filters {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; margin: 20px 0 24px;
  }
  .field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 190px; min-width: 0; }
  .field:has(button) { flex: 0 0 auto; }
  .field label { font-size: 12px; color: var(--ink-2); font-weight: 500; }
  .field input, .field select {
    font: inherit; padding: 7px 10px; min-width: 0; width: 100%;
    color: var(--ink); background: var(--plane);
    border: 1px solid var(--baseline); border-radius: 7px;
  }
  .field input:focus-visible, .field select:focus-visible,
  button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .check { flex-direction: row; align-items: center; gap: 8px; padding-bottom: 8px; flex: 0 1 auto; }
  .check input { min-width: 0; width: 16px; height: 16px; accent-color: var(--accent); }
  .check label { font-size: 14px; color: var(--ink); }
  button {
    font: inherit; padding: 8px 14px; border-radius: 7px; cursor: pointer;
    border: 1px solid var(--baseline); background: var(--plane); color: var(--ink);
  }
  button:hover { border-color: var(--ink-muted); }
  button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
  button.primary:hover { filter: brightness(0.94); }

  /* ---------- KPI-Zeile ---------- */
  .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 14px; }
  .tile {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px;
  }
  .tile .label { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
  .tile .value { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
  .tile.hero .value { font-size: 48px; }
  .tile .note { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }

  /* ---------- Diagramme ---------- */
  .charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 14px; margin-top: 14px; }
  .card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px;
  }
  .card h2 { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
  .card .cap { font-size: 12px; color: var(--ink-muted); margin: 0 0 16px; }

  .bars { display: flex; flex-direction: column; gap: 10px; }
  /* Firmennamen im NGU-Bestand sind lang — die Namensspalte darf mitwachsen,
     der vollstaendige Name steht zusaetzlich im title-Attribut. */
  .bar-row { display: grid; grid-template-columns: minmax(0, 190px) minmax(60px, 1fr) auto; gap: 12px; align-items: center; }
  .bar-name {
    font-size: 13px; color: var(--ink-2);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .bar-track { background: var(--grid); border-radius: 4px; height: 14px; position: relative; }
  .bar-fill {
    height: 100%; background: var(--accent);
    border-radius: 0 4px 4px 0; min-width: 3px;
    transition: width 0.25s ease;
  }
  .bar-val { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
  .bar-row:hover .bar-name { color: var(--ink); }

  .empty { color: var(--ink-muted); font-size: 13px; padding: 12px 0; }
  .error {
    background: var(--surface); border: 1px solid var(--critical);
    border-left-width: 3px; border-radius: var(--radius);
    padding: 16px 20px; margin-bottom: 16px; color: var(--ink);
  }
  .error h2 { font-size: 15px; margin: 0 0 6px; }
  .error code {
    display: block; margin-top: 8px; font-size: 12px; color: var(--ink-2);
    background: var(--plane); padding: 8px 10px; border-radius: 6px;
    overflow-x: auto; white-space: pre;
  }
  [hidden] { display: none !important; }
  .loading { opacity: 0.5; transition: opacity 0.15s; }

/* ---------- Seitenkopf mit Navigation (alle Seiten) ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1140px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 24px; min-height: 54px;
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 600; color: var(--ink); text-decoration: none;
  font-size: 15px; letter-spacing: -0.01em; flex: none;
}
.brand .mark {
  width: 20px; height: 20px; border-radius: 5px;
  background: var(--accent); flex: none;
}
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a {
  color: var(--ink-2); text-decoration: none; font-size: 14px;
  padding: 6px 11px; border-radius: 7px;
}
.topnav a:hover { background: var(--plane); color: var(--ink); }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--plane); font-weight: 500; }
.topnav a.soon { color: var(--ink-muted); cursor: not-allowed; }
.topnav a.soon:hover { background: none; color: var(--ink-muted); }

.topbar-konto { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.konto-name { font-size: 13px; color: var(--ink-2); }
.konto-abmelden {
  font: inherit; font-size: 13px; padding: 5px 10px;
  color: var(--ink-2); background: none;
  border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
}
.konto-abmelden:hover { color: var(--ink); border-color: var(--ink-muted); }

/* ---------- Startseite: Kachel-Navigation ---------- */
.hero { margin: 8px 0 28px; }
.hero h1 { font-size: 28px; margin: 0 0 6px; }
.hero p { color: var(--ink-2); margin: 0; max-width: 62ch; }

.section-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-muted);
  margin: 32px 0 12px;
}
.section-title:first-of-type { margin-top: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.nav-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  text-decoration: none; color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
a.nav-card:hover { border-color: var(--accent); transform: translateY(-2px); }
a.nav-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-card .icon {
  width: 34px; height: 34px; border-radius: 8px; margin-bottom: 6px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex: none;
}
.nav-card .icon svg { width: 19px; height: 19px; }
.nav-card h3 { font-size: 15px; font-weight: 600; margin: 0; }
.nav-card p { font-size: 13px; color: var(--ink-2); margin: 0; line-height: 1.45; }
.nav-card .meta { font-size: 12px; color: var(--ink-muted); margin-top: auto; padding-top: 10px; }

.nav-card.disabled { opacity: 0.62; cursor: default; }
.nav-card.disabled .icon { background: var(--grid); color: var(--ink-muted); }
.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px;
  background: var(--grid); color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.card-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }

/* ---------- Kartenkopf mit eigenem Steuerelement ---------- */
.card-title-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-title-row select {
  font: inherit; font-size: 13px; padding: 5px 9px;
  color: var(--ink); background: var(--plane);
  border: 1px solid var(--baseline); border-radius: 7px;
}
.card-title-row select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Zweite Groesse als Text neben dem Wert — keine zweite Achse. */
.bar-sub { color: var(--ink-muted); font-weight: 400; }
.bar-val { white-space: nowrap; }

/* ---------- Linienchart (Zeitverlauf) ---------- */
.chart-wide { grid-column: 1 / -1; }
.linechart { position: relative; }
.linechart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.lc-grid { stroke: var(--grid); stroke-width: 1; }
.lc-axis { stroke: var(--baseline); stroke-width: 1; }
.lc-area { fill: var(--accent); opacity: 0.10; }
.lc-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc-tick { fill: var(--ink-muted); font-size: 11px; }
.lc-tick.y { text-anchor: end; dominant-baseline: middle; }
.lc-tick.x { text-anchor: middle; }
.lc-cross { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.lc-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.lc-hit { fill: transparent; }
.lc-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 10px; font-size: 12px; color: var(--ink);
  box-shadow: 0 3px 12px rgba(0,0,0,0.10); white-space: nowrap;
  transform: translate(-50%, -100%);
}
.lc-tip b { font-variant-numeric: tabular-nums; }
.lc-tip .sub { color: var(--ink-2); display: block; margin-top: 2px; }
.lc-note { font-size: 12px; color: var(--ink-muted); margin-top: 10px; }

/* ---------- Kartenseite ---------- */
body.map-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.map-shell { flex: 1; display: flex; min-height: 0; }
.map-side {
  width: 310px; flex: none; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px;
}
.map-canvas { flex: 1; position: relative; min-width: 0; overflow: hidden; --claim-leiste-hoehe: 200px; }
.map-canvas .maplibregl-map { position: absolute; inset: 0; transition: bottom 0.2s ease; }
.map-canvas.leiste-offen .maplibregl-map { bottom: var(--claim-leiste-hoehe, 200px); }
/* A-41: Beim Verstellen der Leistenhoehe darf der Kartenrand nicht
   nachlaufen — sonst hat der Container beim map.resize() noch die alte Groesse. */
.map-canvas.leiste-zieht .maplibregl-map { transition: none; }

/* Claim-Infoleiste (A-35) — ersetzt das Claim-Popup: eine Leiste ueber die
   ganze Kartenbreite statt ein Kasten, der die Flaeche verdeckt, auf die man
   gerade schaut. Feste Hoehe (Richtwert 180-220px, siehe --claim-leiste-hoehe)
   statt mitwachsend: eine mitwachsende Leiste spraenge bei jedem Klick auf
   einen anderen Claim um einen anderen Betrag um — das ist die Unruhe, die
   dieser Umbau abschafft. */
.claim-leiste {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  height: var(--claim-leiste-hoehe);
  transform: translateY(100%);
  transition: transform 0.2s ease;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.14);
  display: flex; flex-direction: column;
}
.claim-leiste.offen { transform: translateY(0); }
/* Griff an der Oberkante (A-41): 14px Trefffleche, davon 7px ueber der Leiste;
   die sichtbare Marke ist nur der kleine Balken. Die Hoehe wird bewusst NICHT
   animiert. */
.claim-leiste-griff {
  position: absolute; left: 0; right: 0; top: -7px; height: 14px; z-index: 1;
  cursor: ns-resize; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.claim-leiste-griff::after {
  content: ""; width: 36px; height: 4px; border-radius: 2px;
  background: var(--border); box-shadow: 0 0 0 1px var(--surface);
}
.claim-leiste-griff:hover::after, .claim-leiste-griff:focus-visible::after,
.map-canvas.leiste-zieht .claim-leiste-griff::after { background: var(--accent); }
.claim-leiste-griff:focus-visible { outline: none; }
.claim-leiste-kopf {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); flex: none;
}
.claim-leiste-kopf h3 { margin: 0; font-size: 14px; flex: none; }
.claim-leiste-reiter { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.claim-leiste-reiter button {
  border: 1px solid var(--border); background: var(--plane); color: var(--ink-2);
  border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; flex: none;
}
.claim-leiste-reiter button.aktiv { background: var(--accent); color: #fff; border-color: var(--accent); }
.claim-leiste-schliessen {
  background: none; border: 0; cursor: pointer; font-size: 20px; line-height: 1;
  color: var(--ink-2); padding: 2px 6px; border-radius: 6px; flex: none; margin-left: auto;
}
.claim-leiste-schliessen:hover { background: var(--plane); color: var(--ink); }
.claim-leiste-spalten { flex: 1; display: flex; min-height: 0; }
.claim-spalte {
  flex: 1 1 0; min-width: 0; overflow-y: auto; padding: 8px 14px;
  border-right: 1px solid var(--border);
}
.claim-spalte:last-child { border-right: none; }
.claim-spalte h4 {
  margin: 0 0 6px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-muted);
}
.claim-spalte h5 { margin: 0 0 6px; font-size: 12px; }
.claim-spalte dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 13px; }
.claim-spalte dt { color: var(--ink-2); }
.claim-spalte dd { margin: 0; }
/* Reiter statt Umbruch (Auftragstext): ist die Leiste zu schmal fuer vier
   nebeneinanderliegende Spalten (siehe claimLeisteBreitePruefen in
   claimmap.js), zeigt sie nur die aktive Spalte — sonst kaeme das Scrollen
   zurueck, nur anders angeordnet. */
.claim-leiste.schmal .claim-leiste-spalten { display: block; }
.claim-leiste.schmal .claim-spalte { display: none; height: 100%; border-right: none; }
.claim-leiste.schmal .claim-spalte.aktiv { display: block; }

/* Umfeld der Claims (A-56, Stufe 2b): zweite Ansicht DERSELBEN Leiste — gleicher
   Ort, gleiche feste Hoehe (--claim-leiste-hoehe), also springt die Karte beim
   Umschalten nicht. Vier Spalten (Strasse, Bahn, Strom, Hafen), jede scrollt
   einzeln. [hidden] muss gegen die display-Angaben ausdruecklich gewinnen. */
.claim-leiste-spalten[hidden], .claim-leiste-umfeld[hidden] { display: none; }
.claim-leiste-umfeld { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.claim-leiste-umfeld .claim-leiste-spalten { flex: 1; }
.claim-leiste-kopf h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.claim-leiste-modus { display: flex; flex: none; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.claim-leiste-modus button {
  border: 0; background: var(--plane); color: var(--ink-2); padding: 4px 12px;
  font-size: 12px; cursor: pointer;
}
.claim-leiste-modus button + button { border-left: 1px solid var(--border); }
.claim-leiste-modus button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.umfeld-kopfzeile {
  margin: 0; padding: 4px 14px; font-size: 12px; color: var(--ink-2); flex: none;
  border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Zustaende unterscheiden sich in Schrift und Rahmen, NICHT in Gruen und Rot:
   die Leiste stellt fest, sie bewertet nicht (A-8). */
.umfeld-zeile { margin-bottom: 8px; font-size: 13px; }
.umfeld-klasse { color: var(--ink-2); font-size: 12px; }
.umfeld-wert { font-weight: 600; }
.umfeld-objekt, .umfeld-info { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.umfeld-leer .umfeld-wert { font-weight: 400; }
.umfeld-nicht_geladen .umfeld-wert { font-weight: 400; font-style: italic; color: var(--ink-muted); }
.umfeld-fehlgeschlagen .umfeld-wert {
  font-weight: 400; display: inline-block; padding: 0 5px;
  border: 1px dashed var(--ink-muted); border-radius: 4px;
}
.umfeld-abgesetzt { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--border); }
.umfeld-quelle { margin-top: 10px; }
/* Schmale Leiste (Reiter statt Spalten): die Reiter bekommen eine eigene Zeile
   statt aus der Kopfzeile herauszulaufen; die Kopfzeile des Umfelds darf umbrechen,
   damit "Claim ist neu" und "Abfrage fehlgeschlagen" nicht abgeschnitten werden. */
.claim-leiste.schmal .claim-leiste-kopf { flex-wrap: wrap; row-gap: 6px; }
.claim-leiste.schmal .claim-leiste-reiter { order: 5; flex: 1 1 100%; }
.claim-leiste.schmal .umfeld-kopfzeile { white-space: normal; }
.legende-bilder img { display: block; max-width: 100%; height: auto; margin: 2px 0 6px; background: #fff; }


.side-group { margin-bottom: 20px; }
.side-group > h3 {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-muted); margin: 0 0 8px;
}
.side-group .field { margin-bottom: 10px; }
.side-group .quelle {
  font-size: 11px; line-height: 1.4; color: var(--ink-muted);
  margin: -2px 0 8px; white-space: normal;
}
.quelle-trenner {
  border: 0; border-top: 1px solid var(--border); margin: 18px 0 10px;
}
.toggle {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.toggle:hover { background: var(--plane); }
.toggle input { width: 15px; height: 15px; accent-color: var(--accent); flex: none; margin: 0; }
.toggle .swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; border: 1px solid var(--border); }
.toggle span.txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toggle small { display: block; color: var(--ink-muted); font-size: 11px; white-space: normal; }

/* Layer-Legende (A-27): eingeklappt unter dem Layer-Schalter, nicht die
   Kartenlegende unten rechts — die bleibt unveraendert. */
.legende { margin: 0 0 10px 30px; font-size: 12px; }
.legende > summary {
  cursor: pointer; color: var(--ink-muted); list-style: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.legende > summary::-webkit-details-marker { display: none; }
.legende > summary::before { content: "▸"; font-size: 10px; }
.legende[open] > summary::before { content: "▾"; }
.legende-inhalt { margin-top: 6px; }
.legende-liste { list-style: none; margin: 0; padding: 0; }
.legende-liste li {
  display: flex; align-items: center; gap: 7px; padding: 2px 0;
  white-space: normal; line-height: 1.35;
}
.legende-swatch {
  width: 13px; height: 13px; border-radius: 3px; flex: none;
  border: 1px solid var(--border);
}
.legende-symbol {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.02em; flex: none;
}
.legende-hinweis { color: var(--ink-muted); font-size: 11px; margin: 6px 0 0; }
.legende-link { margin: 4px 0 0; }

.map-status {
  position: absolute; left: 12px; bottom: 12px; z-index: 2;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--ink-2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.map-legend {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.map-legend div { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.map-legend div:first-of-type { margin-top: 0; }
.map-legend i { width: 12px; height: 12px; border-radius: 3px; display: block; flex: none; }
.map-legend strong { font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-muted); display: block; margin-bottom: 7px; }

/* Probendetail (A-19) — bewusst ein eigenes Panel, kein Popup: ein Popup
   schliesst beim naechsten Kartenklick, und genau dann will man zwei Proben
   vergleichen. */
.probe-panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; z-index: 3;
  width: 320px; max-width: calc(100% - 24px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  display: flex; flex-direction: column; overflow: hidden;
}
.probe-panel-kopf {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; padding: 12px 10px 10px 14px; border-bottom: 1px solid var(--border);
  flex: none;
}
.probe-panel-kopf h3 { margin: 0; font-size: 14px; }
.probe-panel-schliessen {
  background: none; border: 0; cursor: pointer; font-size: 20px; line-height: 1;
  color: var(--ink-2); padding: 2px 6px; border-radius: 6px; flex: none;
}
.probe-panel-schliessen:hover { background: var(--plane); color: var(--ink); }
.probe-panel-info {
  padding: 10px 14px; font-size: 12px; color: var(--ink-2); flex: none;
  border-bottom: 1px solid var(--border);
}
.probe-panel-info .zeile { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.probe-panel-info .zeile .bez { color: var(--ink-muted); }
.probe-panel-info .zeile .wert { color: var(--ink); text-align: right; }
.probe-panel-tabelle-wrapper { overflow-y: auto; flex: 1 1 auto; }
.probe-panel-tabelle { width: 100%; border-collapse: collapse; font-size: 12px; }
.probe-panel-tabelle th {
  position: sticky; top: 0; background: var(--surface); text-align: left;
  color: var(--ink-muted); font-weight: 600; text-transform: uppercase;
  font-size: 10px; letter-spacing: 0.04em; padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.probe-panel-tabelle th:not(:first-child), .probe-panel-tabelle td:not(:first-child) { text-align: right; }
.probe-panel-tabelle td { padding: 5px 10px; border-bottom: 1px solid var(--border); }
.probe-panel-tabelle tr.hervorgehoben { background: var(--accent-soft); }
.probe-panel-tabelle tr.hervorgehoben td { font-weight: 600; }
.probe-panel-tabelle .zensiert { color: var(--ink-muted); font-style: italic; }
/* Verfahrensspalte: Text, kein Zahlenwert — deshalb linksbuendig entgegen der
   Regel oben, und gedaempft, weil sie nur der Unterscheidung gleich
   beschrifteter Zeilen dient (dieselbe Probe kann dasselbe Element per ICP
   und per XRF fuehren, siehe GeokjemiStore.probe). */
.probe-panel-tabelle th:nth-child(3),
.probe-panel-tabelle td.verfahren { text-align: left; }
.probe-panel-tabelle td.verfahren { color: var(--ink-muted); font-size: 11px; }
/* Fuehrt die Probe nur ein Verfahren, steht es im Kopf und die Spalte faellt
   weg — sie wuerde in jeder Zeile dasselbe wiederholen. */
.probe-panel-tabelle.ohne-verfahren th:nth-child(3),
.probe-panel-tabelle.ohne-verfahren td.verfahren { display: none; }
.probe-panel-status { padding: 14px; font-size: 12px; color: var(--ink-muted); }

@media (max-width: 760px) {
  .probe-panel { top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; height: 60vh; }
}

.maplibregl-popup-content {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; font: 13px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12); max-width: 300px;
  max-height: 70vh; overflow-y: auto;
}

/* Claim-Akte im Popup (A-2, Stufe 1) */
.claiminfo-liste { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.claiminfo-eintrag { display: flex; gap: 8px; align-items: flex-start; }
.claiminfo-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.claiminfo-datei { font-size: 12px; }
.claiminfo-meta { flex: 1; min-width: 0; font-size: 12px; }
.claiminfo-loeschen {
  display: block; margin-top: 4px; padding: 0; border: 0; background: none;
  color: var(--accent); font: inherit; font-size: 11px; cursor: pointer; text-decoration: underline;
}
.claiminfo-upload { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.claiminfo-upload input[type=file] { max-width: 100%; font-size: 11px; }
.claiminfo-status { width: 100%; margin: 2px 0 0; }
.maplibregl-popup-content h4 { margin: 0 0 6px; font-size: 14px; }
.maplibregl-popup-content dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.maplibregl-popup-content dt { color: var(--ink-2); }
.maplibregl-popup-content dd { margin: 0; }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; }
.maplibregl-popup-close-button { color: var(--ink-2); font-size: 18px; padding: 2px 7px; }
.probe-link {
  display: block; margin-top: 8px; padding: 0; border: 0; background: none;
  color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline;
}

@media (max-width: 760px) {
  body.map-page { height: auto; overflow: visible; }
  .map-shell { flex-direction: column; }
  .map-side { width: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .map-canvas { height: 65vh; }
}

/* ---------- Datentabelle (Flurkarten) ---------- */
.table-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-top: 14px; overflow: hidden;
}
/* Breite Tabellen scrollen in ihrem eigenen Kasten — die Seite selbst
   bekommt dadurch nie einen horizontalen Scrollbalken. */
.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td {
  text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
table.data thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface); color: var(--ink-2);
  font-weight: 500; font-size: 12px;
  border-bottom: 1px solid var(--baseline);
}
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--ink); }
table.data thead th .arrow { color: var(--ink-muted); font-size: 10px; margin-left: 4px; }
table.data tbody tr:hover { background: var(--plane); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.wide { white-space: normal; min-width: 180px; }

/* Coverage als Balken hinter der Zahl: der Vergleich zwischen den Zeilen
   ist die eigentliche Aussage, nicht der Einzelwert. */
.pct-cell { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.pct-bar { width: 62px; height: 6px; border-radius: 3px; background: var(--grid); flex: none; }
.pct-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.pct-num { font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }

.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-top: 1px solid var(--grid);
  font-size: 13px; color: var(--ink-2);
}
.table-foot .pager { display: flex; align-items: center; gap: 8px; }

/* ---------- Fachbegriffe (A-14) ---------- */
table.data td.wide input[type="text"],
table.data td.wide textarea,
table.data td.wide select {
  font: inherit; width: 100%; min-width: 140px; box-sizing: border-box;
  padding: 6px 8px; color: var(--ink); background: var(--plane);
  border: 1px solid var(--baseline); border-radius: 6px;
}
table.data td.wide textarea { resize: vertical; min-height: 2.2em; }
.fb-vorschlaege-andere { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.fb-vorschlaege-andere strong { color: var(--ink); font-weight: 500; }
.fb-eigen { display: flex; flex-direction: column; gap: 6px; }
.fb-entscheidung { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.fb-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.fb-fundort { margin-top: 2px; font-size: 12px; color: var(--ink-muted); }
.fb-zweifel { color: var(--ink-2); }
/* Eigene, engere Klasse fuer die Fachbegriffe-Tabelle (A-14) — table.data selbst
   bleibt unangetastet, das teilen sich Bergrechte, Flurkarten und Geochemie. */
table.data.kompakt th, table.data.kompakt td { padding: 4px 10px; }
table.data.kompakt td.wide { min-width: 120px; }
/* Fundstelle darf umbrechen (erbt sonst nowrap von table.data); Spalte 1 gedeckelt. */
table.data.kompakt tr.fb-row td:first-child { max-width: 320px; }
table.data.kompakt .fb-fundort { white-space: normal; line-height: 1.3; margin-top: 0; }
table.data.kompakt tr.fb-row td { line-height: 1.35; }
/* Eingabespalte: Textfeld und Knopf in einer Zeile; Bemerkung nur bei Fokus oder
   gespeichertem/getipptem Text (placeholder-shown faellt weg, sobald etwas drinsteht). */
table.data.kompakt .fb-eigen { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; min-width: 170px; }
table.data.kompakt .fb-eigen-bemerkung,
table.data.kompakt .fb-eigen .fb-gespeichert { grid-column: 1 / -1; }
table.data.kompakt .fb-eigen-bemerkung { display: none; }
table.data.kompakt .fb-eigen:focus-within .fb-eigen-bemerkung,
table.data.kompakt .fb-eigen-bemerkung:not(:placeholder-shown) { display: block; }
table.data.kompakt .fb-eigen .fb-gespeichert[hidden] { display: none; }
table.data.kompakt td.wide .fb-eigen input[type="text"] { min-width: 0; padding-top: 3px; padding-bottom: 3px; font-size: 13px; }
/* Flachere Bedienelemente in der Pruefliste, damit mehr Eintraege auf einen Schirm passen. */
table.data.kompakt .fb-eigen input, table.data.kompakt .fb-eigen button,
table.data.kompakt .fb-entscheidung select, table.data.kompakt .fb-entscheidung button { padding-top: 3px; padding-bottom: 3px; font-size: 13px; }
/* Status-Spalte (Admin): gleiches Muster — Auswahl und Knopf nebeneinander,
   Begruendung nur bei Fokus oder vorhandenem Text. */
table.data.kompakt .fb-entscheidung { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; min-width: 170px; }
table.data.kompakt .fb-begruendung,
table.data.kompakt .fb-entscheidung .fb-gespeichert { grid-column: 1 / -1; }
table.data.kompakt .fb-begruendung { display: none; }
table.data.kompakt .fb-entscheidung:focus-within .fb-begruendung,
table.data.kompakt .fb-begruendung:not(:placeholder-shown) { display: block; }
table.data.kompakt .fb-entscheidung .fb-gespeichert[hidden] { display: none; }
tr.fb-detail td.fb-detail-zelle { white-space: normal; padding-top: 1px; padding-bottom: 3px; font-size: 13px; line-height: 1.3; }
/* Eintrag und Unterzeile sollen beim Ueberfahren gemeinsam hervortreten. */
table.data tbody tr.fb-row:has(+ tr.fb-detail:hover) { background: var(--plane); }
table.data tbody tr.fb-row:hover + tr.fb-detail { background: var(--plane); }
.fb-status-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.fb-status-badge.offen { background: var(--plane); color: var(--ink-2); }
.fb-status-badge.uebernommen { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.fb-status-badge.verworfen { background: color-mix(in srgb, var(--critical) 20%, transparent); color: var(--critical); }
.fb-gespeichert { font-size: 12px; color: var(--good); }
.section-title.fb-section { margin-top: 24px; }

/* ---------- Eingebettete Karte (Flurkarten-Seite) ---------- */
.map-inline {
  position: relative; margin-top: 14px;
  /* Mitwachsend statt fest: auf einem grossen Schirm ist die Karte das
     Wichtigste auf der Seite, auf einem kleinen darf sie nicht alles
     verdraengen. Untergrenze, damit sie im schmalen Fenster nutzbar bleibt. */
  height: clamp(460px, 68vh, 900px);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
}

/* Vollbild ohne die native Fullscreen-API: die blendet den Seitenkopf aus und
   verliert im Browser-Vollbild die Tastaturbedienung der Seite. Diese Variante
   bleibt ein normales Element, nur bildschirmfuellend. */
.map-inline.vollbild {
  position: fixed; inset: 0; z-index: 60;
  height: auto; margin: 0; border-radius: 0; border: none;
}
.map-vollbild-schalter {
  /* Oben rechts: unten rechts sitzt schon die Massstabsleiste von MapLibre,
     oben links die Zoomknoepfe, unten links die Statusanzeige. */
  position: absolute; right: 12px; top: 12px; z-index: 3;
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13px; padding: 7px 12px;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.map-vollbild-schalter:hover { border-color: var(--ink-muted); }
.map-vollbild-schalter svg { width: 15px; height: 15px; }
.map-inline .maplibregl-map { position: absolute; inset: 0; }
.map-inline .map-status, .map-inline .map-legend { position: absolute; }
.map-inline .map-status { left: 12px; bottom: 12px; }
/* bottom MUSS zurueckgesetzt werden: die Grundregel oben setzt bottom:12px,
   und ein absolut positioniertes Element mit top UND bottom streckt sich ueber
   die volle Hoehe — die Legende war deshalb ein hoher, fast leerer Kasten. */
.map-inline .map-legend { right: 12px; top: 56px; bottom: auto; }
/* Zeilenaktion "In Karte zeigen" — als Link, nicht als Button: sie navigiert
   innerhalb der Seite, sie loest nichts aus. */
button.linklike {
  border: none; background: none; padding: 0; color: var(--accent);
  font: inherit; cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px;
}
button.linklike:hover { filter: brightness(0.85); }

/* ---------- Hinweisleiste mit Aktion ---------- */
.notice {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--warning); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 16px;
}
.notice strong { display: block; font-size: 14px; margin-bottom: 2px; }
.notice span { color: var(--ink-2); font-size: 13px; }
.notice button { flex: none; }
.notice button:disabled { opacity: 0.6; cursor: default; }

/* ---------- Sprachumschalter im Seitenkopf ---------- */
.sprachwahl {
  flex: none;
  font: inherit; font-size: 13px; padding: 5px 9px;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px;
}
/* Auf der Anmeldeseite gibt es keine .topbar-konto-Gruppe, die den
   Umschalter nach rechts schiebt -- dort uebernimmt der Umschalter selbst. */
.login-page .sprachwahl { margin-left: auto; }
.sprachwahl:hover { color: var(--ink); border-color: var(--ink-muted); }
.sprachwahl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Kennzahlen in der Geochemie-Seitenleiste.
   Bewusst untereinander statt nebeneinander: die Beschriftungen sind
   unterschiedlich lang ("Median" gegen "unter Nachweisgrenze"), nebeneinander
   rutschen Wert und Bezeichnung dadurch auseinander und man liest die falsche
   Zahl zur falschen Zeile. */
.geo-stats { display: flex; flex-direction: column; gap: 2px; }
.geo-stats .zeile {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.geo-stats .zeile:last-of-type { border-bottom: none; }
.geo-stats .bez { font-size: 12px; color: var(--ink-muted); }
.geo-stats .wert {
  font-size: 14px; font-weight: 600;
  /* Ziffern gleich breit — sonst zappeln die Werte beim Nachladen */
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Anmeldeseite ---------- */
body.login-page { min-height: 100vh; display: flex; flex-direction: column; }
.login-mitte {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 26px;
}
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
.login-card p.sub { margin: 0 0 20px; }
.login-card .field { margin-bottom: 14px; }
.login-card button.primary { width: 100%; margin-top: 4px; }
.login-fehler {
  background: var(--surface); border: 1px solid var(--critical);
  border-left-width: 3px; border-radius: 7px;
  padding: 10px 12px; margin-bottom: 14px; font-size: 13px; color: var(--ink);
}

/* ---------- Konto ---------- */
a.konto-name { text-decoration: none; }
a.konto-name:hover { text-decoration: underline; }
.konto-mitte { display: flex; justify-content: center; padding: 32px 24px; }
.konto-ok {
  background: var(--surface); border: 1px solid var(--border);
  border-left-width: 3px; border-radius: 7px;
  padding: 10px 12px; margin-bottom: 14px; font-size: 13px; color: var(--ink);
}

/* ---------- Strategische Projekte (A-50) ---------- */
.sp-meta { color: var(--ink-2); font-size: 12px; margin: 0 0 8px; }
.sp-herkunft { color: var(--ink-muted); font-size: 12px; margin: 8px 0 0; }
.sp-hinweis { color: var(--ink-2); font-size: 13px; margin: 0 0 10px; max-width: 80ch; }

.sp-band {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--baseline); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 12px; font-size: 13px;
}
.sp-band strong { font-size: 14px; }
.sp-band span { color: var(--ink-2); }
.sp-band.warnung { border-left-color: var(--warning); }
.sp-band.kritisch { border-left-color: var(--critical); }
.sp-band.ok { border-left-color: var(--good); padding: 8px 16px; }
.sp-band.neutral { border-left-color: var(--ink-muted); }

.sp-runden { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.sp-runde {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.sp-runde.gesamt { border-color: var(--baseline); }
.sp-runde-zahl { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sp-runde-name { font-size: 13px; font-weight: 600; }
.sp-runde-beschluss { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

table.sp-matrix th, table.sp-matrix td { text-align: right; }
table.sp-matrix th:first-child, table.sp-matrix .sp-zeilenkopf { text-align: left; font-weight: 500; }
.sp-null { color: var(--ink-muted); }
button.sp-zelle {
  font: inherit; font-variant-numeric: tabular-nums; min-width: 2.4em;
  background: var(--accent-soft); color: var(--ink); border: 1px solid transparent;
  border-radius: 6px; padding: 2px 8px; cursor: pointer;
}
button.sp-zelle:hover { border-color: var(--accent); }
button.sp-zelle.gewaehlt { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }

.sp-filter { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.sp-filter select { font: inherit; font-size: 13px; padding: 5px 9px; }
.sp-anzahl { color: var(--ink-muted); }
.sp-richtwerte { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; max-width: 80ch; }
.sp-richtwerte p { margin: 0 0 8px; font-size: 13px; }
.sp-richtwerte p:last-child { margin-bottom: 0; }
.sp-quelle { color: var(--ink-muted); }
.sp-keine-abdeckung { color: var(--ink-2); }
.sp-landhinweis { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
.sp-landhinweis:empty { display: none; }

/* ---------- Benutzerverwaltung (Auftrag A-60) ---------- */
.konto-benutzer { color: var(--ink-2); font-size: 13px; text-decoration: none; }
.konto-benutzer:hover { color: var(--ink); }
.benutzer-neu { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.benutzer-pw-feld { flex: 1 1 260px; }
.benutzer-pw-zeile { display: flex; gap: 6px; }
.benutzer-pw-zeile input { flex: 1 1 auto; font-family: monospace; }
.benutzer-pw-zeile button { flex: none; }
table.data .benutzer-rolle-auswahl,
table.data .benutzer-sperre-schalter { font: inherit; }
.benutzer-eigen-hinweis { color: var(--ink-muted); font-size: 12px; }
.benutzer-eigen-hinweis a { color: inherit; }
.benutzer-sperren-bestaetigen { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.benutzer-sperren-bestaetigen span { font-size: 12px; color: var(--ink-2); }
