/* 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; }
.map-canvas .maplibregl-map { position: absolute; inset: 0; }

.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;
}
.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: 5px 10px; }
table.data.kompakt td.wide { min-width: 120px; }
tr.fb-detail td.fb-detail-zelle { white-space: normal; padding-top: 2px; font-size: 13px; }
/* 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);
}
