/* ---------------------------------------------------------------------------
   Vectral 2.0 — Faktenbasis (Screens 7–11) und Warnungen (16)
   T18 n: aus app.css herausgelöst (Kennzahlen, Kacheln, Matrix).
   Neue B4-Regeln stehen unter „B4" am Ende.
--------------------------------------------------------------------------- */

/* === Kennzahlen ========================================================= */

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: 22px 24px 24px;
}
.kpi .k-head { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.kpi .k-label { font-size: 13px; }
.kpi .k-value {
  font-size: 36px; font-weight: 800; letter-spacing: -.035em; line-height: 1.05;
  font-variant-numeric: tabular-nums; margin-top: 8px;
}
.kpi .k-value .unit { font-size: .5em; font-weight: 500; color: var(--muted); letter-spacing: -.01em; }
.kpi .k-foot { font-size: 11.5px; color: var(--muted-2); margin-top: 6px; }

/* === Auswertungs-Kacheln ================================================ */

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .tiles { grid-template-columns: 1fr; } }
.tile {
  display: grid; grid-template-columns: 46px 1fr 20px; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 18px 20px; text-decoration: none; color: inherit;
  transition: border-color var(--dur-hover) ease, box-shadow var(--dur-hover) ease,
              transform var(--dur-hover) var(--ease-out);
}
.tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-pop); text-decoration: none; }
.tile:active { transform: scale(.985); box-shadow: var(--shadow-card); }
.tile .t-arrow { transition: color var(--dur-hover) ease, transform var(--dur-hover) var(--ease-out); }
/* Touch löst Hover beim Tippen aus — die Anhebung bleibt der Maus vorbehalten. */
@media (hover: hover) and (pointer: fine) {
  .tile:hover { transform: translateY(-1px); }
  .tile:hover .t-arrow { transform: translateX(2px); }
}
.tile .t-icon {
  width: 46px; height: 46px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--navy-soft); color: var(--navy); border: 1px solid var(--navy-line);
}
.tile.is-chart .t-icon { background: var(--vorschlag-soft); color: var(--vorschlag); border-color: var(--vorschlag-line); }
.tile .t-title { font-size: 15.5px; font-weight: 700; margin-top: 6px; }
.tile .t-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.tile .t-arrow { color: var(--muted-2); }
.tile:hover .t-arrow { color: var(--navy); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--navy-soft); border: 1px solid var(--navy-line);
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--navy);
}
.chip.is-chart { background: var(--vorschlag-soft); border-color: var(--vorschlag-line); color: var(--vorschlag); }

/* === Matrix ============================================================= */

.matrix { display: grid; gap: 3px; }
.matrix .mx-row { display: grid; gap: 3px; align-items: center; }
.matrix .mx-head { font-size: 11.5px; color: var(--muted); text-align: center; font-weight: 600; }
.matrix .mx-side { font-size: 11.5px; color: var(--muted); text-align: right; padding-right: 10px; white-space: nowrap; font-weight: 600; }
.matrix .mx-cell {
  height: 34px; border-radius: 4px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: var(--navy);
}
.matrix .mx-cell.on-dark { color: #fff; }
.matrix .mx-cell.is-diag {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface) 4px, var(--surface) 8px);
  color: var(--muted-2);
}

@media (prefers-reduced-motion: reduce) {
  .tile:hover, .tile:hover .t-arrow, .tile:active { transform: none; }
}

/* === B4 === */
/* Filterleiste (Mehrfachauswahl als Klappliste), Faktenbasis-Karte auf
   Screen 7, Grundriss mit Gang-Beschriftung (8), ABC (9), Kreuz (11),
   Warnungen (16). Nur vorhandene Tokens; Klasse D in #8b5cf6 (K19).       */

/* --- Filterleiste ------------------------------------------------------- */
.filterbar[data-filterform] { align-items: center; gap: 10px; }
.filterfield.ff-zeit { min-width: 0; }
.filterfield.ff-zeit .ff-val { gap: 6px; }
.filterfield.ff-zeit .input { min-height: 34px; padding: 4px 8px; width: 138px; font-size: 12.5px; }
.filterfield.ff-zahl .input, .filterfield.ff-select .input { min-height: 34px; padding: 4px 8px; width: 110px; font-size: 12.5px; }
.filterfield.ff-select .input { width: 150px; }
.ff-multi { position: relative; padding: 0; min-width: min(168px, 100%); }
.ff-multi .ff-val { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.ff-multi summary { list-style: none; cursor: pointer; padding: 6px 30px 6px 12px; }
.ff-multi summary::-webkit-details-marker { display: none; }
.ff-multi summary::after { content: '▾'; position: absolute; right: 10px; top: 8px; color: var(--muted-2); font-size: 12px; }
.ff-multi[open] summary::after { content: '▴'; }
.ff-multi.is-off { opacity: .6; }
.ff-multi.is-off summary { cursor: not-allowed; }
.ff-multi.is-off summary::after { content: ''; }
.ff-multi.is-off .ff-val { font-weight: 500; color: var(--muted); font-style: italic; }
.ff-liste {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; min-width: 100%; max-height: 260px; overflow: auto;
  display: grid; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
}
.ff-liste label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.ff-liste label:hover { background: var(--surface-2); }
.ff-liste input { width: 15px; height: 15px; accent-color: var(--link); margin: 0; }
.ff-actions { display: inline-flex; align-items: center; gap: 14px; margin-left: auto; white-space: nowrap; }
.abc-schwellen { align-items: flex-end; }
.abc-schwellen .fb-label { align-self: center; }

/* --- Screen 7: Kennzahlen-Details --------------------------------------- */
.kpi-details summary { cursor: pointer; color: var(--navy); font-weight: 600; }
.kpi-details .refrow { padding: 8px 0; }
.kpi-details > div { columns: 2; column-gap: 32px; }
@media (max-width: 800px) { .kpi-details > div { columns: 1; } }
.fb-karte .row-between .btn { margin-left: auto; }
/* Kopfzeile der Faktenbasis-Karte: bausteine.css (die Karte erscheint auch auf Screen 12/13 ohne diese Datei). */

/* --- Screen 8: Grundriss mit Gang-Beschriftung und Hotspots ------------- */
.ph-grundriss { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
.ph-labels { display: grid; gap: 11px; padding: 14px 0; align-content: start; }
.ph-labels .gr-label { height: 13px; line-height: 13px; }
.hotspot { z-index: 3; }
.hotspot span { z-index: 4; }
#lagerAuswahl .modeswitch .pl-meta { font-weight: 500; }
#lagerAuswahl .modeswitch button.is-active .pl-meta { color: rgb(255 255 255 / .8); }
/* Viele Lager: Chips umbrechen (bis 12), darüber Auswahlliste „Lager · Anteil“ */
.ph-chips { flex-wrap: wrap; max-width: 100%; }
.ph-chips button { padding: 6px 12px; }
.ph-lagerwahl .input { width: auto; min-width: 220px; }
#lagerAuswahl { min-width: 0; max-width: 100%; }
.row-between.wrap > #lagerAuswahl { flex: 1 1 320px; display: flex; justify-content: flex-end; }

/* --- Screen 9: Klasse D ------------------------------------------------- */
.badge-d { background: rgb(139 92 246 / .12); color: #8b5cf6; border-color: rgb(139 92 246 / .35); }
.table-std tr.is-d td { color: var(--muted); }
.legend .lg i[style] { border: 1px solid rgb(0 0 0 / .08); }

/* --- Screen 11: ABC-Matrix und Reiter ----------------------------------- */
.abc-matrix .mx-cell { height: 52px; line-height: 1.2; font-size: 13px; }
.abc-matrix .mx-cell small { display: block; font-size: 10.5px; font-weight: 500; opacity: .8; }
.abc-matrix .mx-side.tiny { font-weight: 500; }
.fb-reiter { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-reiter button {
  padding: 7px 14px; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 600;
  transition: border-color var(--dur-hover) ease, background-color var(--dur-hover) ease, color var(--dur-hover) ease;
}
.fb-reiter button:hover { border-color: var(--border-strong); color: var(--ink); }
.fb-reiter button.is-active { background: var(--navy-fill); border-color: var(--navy-fill); color: #fff; }
.fb-reiter button .pl-meta { font-weight: 500; }
.fb-reiter button.is-active .pl-meta { color: rgb(255 255 255 / .8); }
.fb-reiter button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.modeswitch button:disabled { opacity: .5; cursor: not-allowed; }

/* --- Drilldown-Navigation (B27) ------------------------------------------ */
.dd-pfad { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dd-krume { background: none; border: none; color: var(--link); cursor: pointer; padding: 0; font: inherit; }
.dd-krume.is-aktiv { color: var(--ink); font-weight: 600; cursor: default; }
.dd-sep { color: var(--muted-2); }

/* --- Screen 16: Warnungen ------------------------------------------------ */
.wn-optionen { display: grid; gap: 8px; }
.wn-option { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; color: var(--muted); }
.wn-option.is-gewaehlt { border-color: var(--navy); color: var(--ink); font-weight: 700; }
.wn-betroffen { text-align: right; font-weight: 500; }
.refrow b.wn-betroffen { font-weight: 500; max-width: 60%; min-width: 0; overflow-wrap: anywhere; }
.picklist button > span:first-child { min-width: 0; }
/* Lange details-Werte (z. B. 342 Gangnamen): umbrechen, kürzen, nie über die Karte hinaus */
#warndetails { min-width: 0; max-width: 100%; overflow-x: hidden; }
#warndetails .card, .wn-details, .wn-block { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.wn-details { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12.5px; }
.wn-block > .muted { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.wn-liste { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.wn-liste li { padding: 2px 8px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); font-family: var(--mono); font-size: 11.5px; max-width: 100%; overflow-wrap: anywhere; }
.wn-mehr { margin-top: 6px; }
.wn-mehr summary { cursor: pointer; color: var(--navy); font-weight: 600; font-size: 12px; }
.wn-mehr[open] summary { margin-bottom: 6px; }
.wn-kv { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; }
.wn-kv dt { color: var(--muted); }
.wn-kv dd { margin: 0; font-variant-numeric: tabular-nums; }
