/* Paket «Auswertung»: Menü, Ergebnisboxen über dem Graph, Dialog für Anpassungen. */

/* Menü «Auswerten» */
.ausw-knopf::after { content: ' ▾'; color: var(--muted); }
.ausw-menu {
  position: fixed; z-index: 40; display: grid; gap: 2px; padding: 6px; min-width: 240px; max-width: calc(100vw - 16px);
  border: 1px solid var(--glass-edge); border-radius: 12px; background: var(--glass-strong); color: var(--text); box-shadow: var(--shadow);
}
.ausw-menu[hidden] { display: none; }
.ausw-menu button { text-align: left; border: 0; background: transparent; padding: 8px 12px; display: flex; align-items: center; gap: 8px; }
.ausw-menu button:hover, .ausw-menu button:focus-visible { background: var(--btn-hover); }
.ausw-menu button[role="menuitemcheckbox"]::before { content: ''; width: 14px; height: 14px; border: 1.5px solid var(--muted); border-radius: 4px; flex: none; }
.ausw-menu button[aria-checked="true"]::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--glass-strong); }
.ausw-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.ausw-m-titel { display: grid; gap: 1px; }
.ausw-m-text { color: var(--muted); font-size: var(--gr-label); line-height: 1.35; max-width: 290px; }
.ausw-erkl { margin-top: 6px; font-size: var(--gr-label); color: var(--muted); }
.ausw-erkl summary { border: 0; background: transparent; padding: 2px 0; min-height: 0; color: var(--accent); font-size: var(--gr-label); }
.ausw-erkl p { margin: 4px 0 0; line-height: 1.45; }
.ausw-menu-info { margin: 2px 12px 6px; font-size: var(--gr-klein); color: var(--muted); font-family: var(--schrift-mono); }
.ausw-menu-zeile { display: flex; align-items: center; gap: 6px; }
.ausw-menu-zeile button { flex: 1; }
.ausw-menu-zeile label { display: flex; align-items: center; gap: 6px; margin: 0 8px 0 0; white-space: nowrap; }
.ausw-n { width: 58px; padding: 4px 6px; font-family: var(--schrift-mono); }
.ausw-farbe { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* Ergebnisboxen: dezent und kompakt (Name gedämpft, Wert in Mono) */
.ausw-stapel {
  position: absolute; top: 14px; right: 22px; z-index: 2; display: flex; flex-direction: column; gap: 6px;
  max-height: calc(100% - 66px); overflow-y: auto; pointer-events: none; scrollbar-width: thin; align-items: stretch;
}
.ausw-box {
  pointer-events: auto; width: auto; min-width: 170px; max-width: min(280px, 60cqw, calc(100vw - 60px));
  background: var(--glass-strong); border: 1px solid var(--glass-edge); border-left: 3px solid var(--ausw-farbe, var(--accent));
  border-radius: 8px; box-shadow: none; font-size: var(--gr-klein); color: var(--text);
}
.ausw-box.frei { position: absolute; z-index: 3; width: max-content; }
.ausw-box.klein .ausw-inhalt, .ausw-box.klein .ausw-fuss { display: none; }
.ausw-box.klein .ausw-kopf { padding-bottom: 4px; }
.ausw-kopf { display: flex; align-items: flex-start; gap: 4px; padding: 4px 2px 0 9px; cursor: grab; touch-action: none; user-select: none; }
.ausw-kopf:active { cursor: grabbing; }
.ausw-titel { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; line-height: 1.3; padding-top: 4px; }
.ausw-titel b { flex: none; font-weight: 600; font-size: var(--gr-klein); }
.ausw-sub { min-width: 0; color: var(--muted); font-size: var(--gr-label); font-family: var(--schrift-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ausw-zu { flex: none; width: 24px; height: 24px; color: var(--muted); }
.ausw-inhalt { padding: 2px 9px 5px; }
.ausw-gl { font-family: var(--schrift-mono); font-size: var(--gr-label); color: var(--muted); margin: 0 0 3px; line-height: 1.35; }
.ausw-werte { border-collapse: collapse; font-family: var(--schrift-mono); font-variant-numeric: tabular-nums; }
.ausw-werte th { text-align: left; font-weight: 400; padding: 1px 10px 1px 0; color: var(--muted); font-family: var(--schrift-text); white-space: nowrap; }
.ausw-werte td { padding: 1px 0; white-space: nowrap; text-align: right; }
.ausw-werte td.ausw-einheit { text-align: left; }
.ausw-einheit { color: var(--muted); padding-left: 5px !important; }
.ausw-guete, .ausw-bereich { font-family: var(--schrift-mono); font-size: var(--gr-label); color: var(--muted); margin-top: 3px; line-height: 1.4; }
.ausw-bereich { color: var(--faint, var(--muted)); }
.ausw-hinweis { margin: 3px 0 0; font-size: var(--gr-label); color: var(--warn); line-height: 1.35; }
.ausw-fehler { margin: 3px 0; font-size: var(--gr-klein); color: var(--err); line-height: 1.4; }
.ausw-fuss { display: flex; gap: 4px; padding: 0 9px 6px; flex-wrap: wrap; }
.ausw-fuss:empty { display: none; }
.ausw-fuss .chip { min-height: 24px; padding: 2px 9px; font-size: var(--gr-label); }
.ausw-residuen { display: block; margin-top: 5px; border-top: 1px solid var(--line); max-width: 100%; }
.ausw-box .ausw-erkl { margin-top: 3px; }

/* Dialog (nicht modal, damit der Graph mit der Vorschau sichtbar bleibt): Kopf und Knöpfe bleiben stehen */
.ausw-dialog[open] {
  position: fixed; inset: auto 16px 16px auto; margin: 0; width: min(400px, calc(100vw - 24px)); max-height: min(80dvh, calc(100dvh - 24px));
  display: flex; flex-direction: column; padding: 0 18px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; z-index: 30;
}
.ausw-d-kopf {
  position: sticky; top: 0; z-index: 3; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 -18px 8px; padding: 10px 8px 8px 18px; background: var(--dlg-grund, var(--glass-strong)); box-shadow: 0 1px 0 var(--line);
}
.ausw-d-kopf h2 { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ausw-dialog > .hinweis { margin: 0 0 8px; }
.ausw-dialog > .dialog-knoepfe {
  position: sticky; bottom: 0; z-index: 3; flex: none; margin: 12px -18px 0; padding: 10px 18px 14px;
  background: var(--dlg-grund, var(--glass-strong)); border-top: 1px solid var(--line);
}
.ausw-d-zeile { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: center; margin: 6px 0; font-size: var(--gr-panel); color: var(--muted); }
.ausw-d-zeile input, .ausw-d-zeile select { width: 100%; min-width: 0; }
.ausw-d-gl { font-family: var(--schrift-mono); font-size: var(--gr-text); margin: 10px 0; padding: 8px 10px; background: var(--btn); border-radius: 8px; min-height: 1.4em; overflow-wrap: anywhere; }
.ausw-d-gl:empty { display: none; }
.ausw-dialog details { margin: 6px 0; }
.ausw-dialog summary { border: 0; background: transparent; padding: 4px 0; min-height: 0; }
.ausw-regler { display: grid; grid-template-columns: 48px minmax(0, 1fr) 90px auto; gap: 8px; align-items: center; margin: 6px 0; font-size: var(--gr-panel); }
.ausw-regler label { font-family: var(--schrift-mono); }
.ausw-regler input[type="range"] { width: 100%; accent-color: var(--accent); }
.ausw-regler input[type="text"] { width: 100%; min-width: 0; }
.ausw-d-erg { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; font-size: var(--gr-panel); }
.ausw-d-erg .ausw-guete { font-size: var(--gr-klein); }
.ausw-d-erg .ausw-werte th { color: var(--text); font-family: var(--schrift-mono); font-weight: 500; }

@media (pointer: coarse) {
  .ausw-menu button { min-height: 44px; }
  .ausw-erkl summary, .ausw-dialog summary { min-height: 44px; display: list-item; padding: 12px 0; }
  .ausw-kopf { min-height: 44px; }
  .ausw-zu { width: 44px; height: 44px; }
  .ausw-fuss .chip { min-height: 44px; }
  .ausw-regler input[type="range"] { min-height: 44px; }
}
@media (max-width: 640px) {
  .ausw-stapel { right: 8px; top: 8px; max-height: calc(100% - 50px); }
  .ausw-box { max-width: calc(100vw - 40px); min-width: 0; }
  .ausw-dialog[open] { inset: auto 8px 8px 8px; width: auto; max-height: 70dvh; padding: 0 14px; }
  .ausw-d-kopf { margin: 0 -14px 8px; padding-left: 14px; }
  .ausw-dialog > .dialog-knoepfe { margin: 12px -14px 0; padding: 10px 14px max(12px, env(safe-area-inset-bottom)); }
  .ausw-dialog > .dialog-knoepfe > button { flex: 1 1 0; }
  .ausw-regler { grid-template-columns: 40px 1fr 76px; }
  .ausw-regler .ausw-einheit { grid-column: 3; }
  .ausw-menu { left: 8px !important; right: 8px; max-height: calc(100dvh - 16px); overflow-y: auto; }
}
