:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --side: #e9ebee;
  --line: #d5d9de;
  --ink: #1d2329;
  --muted: #69727c;
  --accent: #2f6db5;
  --accent-soft: #dfe9f6;
  --rr: #2f6db5;
  --break: #d2402f;
  --vlf: #c9ccd1;
  --lf: #f0a95b;
  --hf: #7fb3e3;
  --resp: #3c9a4a;
  --pns: #4d93d1;
  --sns: #e58a2c;
  --low: #f6d9b8;
  --norm: #e6eef7;
  --high: #c9def2;
  --warn: #9a5a00;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); height: 100vh; display: grid; grid-template-rows: 44px 1fr; overflow: hidden; }
button, input, select { font: inherit; }
button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 4px; padding: 4px 10px; cursor: pointer; color: var(--ink);
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }

header { display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
header h1 { font-size: 15px; margin: 0 16px 0 0; font-weight: 600; }
header .status { color: var(--muted); }
header .spacer { flex: 1; }

.body { display: grid; grid-template-columns: 290px 1fr; min-height: 0; }
aside { background: var(--side); border-right: 1px solid var(--line); overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 12px; }
aside h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 0 4px; font-weight: 600; }

.list { display: flex; flex-direction: column; gap: 1px; }
.rec { padding: 5px 8px; border-radius: 4px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 0 8px; }
.rec:hover { background: #dde1e6; }
.rec.on { background: var(--accent); color: #fff; }
.rec .d { font-weight: 500; }
.rec .x { color: var(--muted); font-size: 12px; text-align: right; }
.rec.on .x { color: #dbe7f6; }
.rec .s { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
.rec.on .s { color: #dbe7f6; }
.rec.off { opacity: .55; cursor: default; }
details > summary { cursor: pointer; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 4px 0; }

.box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.box h3 { margin: 0 0 6px; font-size: 13px; }
.file-info { font-size: 12px; color: var(--muted); line-height: 1.5; }
.file-info b { color: var(--ink); font-weight: 600; }

.sections { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; }
.sec { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.sec:hover { background: #f0f2f4; }
.sec.on { background: var(--accent-soft); }
.sec .chip { width: 12px; height: 12px; border-radius: 2px; }
.sec .t { color: var(--muted); }
.form { display: grid; grid-template-columns: 70px 1fr; gap: 5px 8px; align-items: center; font-size: 12px; margin-top: 6px; }
.form input { width: 100%; padding: 3px 6px; border: 1px solid var(--line); border-radius: 3px; }
.row-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; }

main { overflow-y: auto; padding: 10px 14px 30px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.empty { margin: 80px auto; color: var(--muted); text-align: center; max-width: 460px; line-height: 1.6; }

.tacho-box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px 6px; }
.toolbar { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.toolbar .seg button { border-radius: 0; margin-left: -1px; }
.toolbar .seg button:first-child { border-radius: 4px 0 0 4px; }
.toolbar .seg button:last-child { border-radius: 0 4px 4px 0; }
.toolbar .seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.toolbar .info { margin-left: auto; color: var(--muted); font-size: 12px; }
canvas { display: block; width: 100%; }
#tacho { height: 270px; cursor: crosshair; }
#overview { height: 46px; margin-top: 4px; cursor: grab; }
.tip { position: fixed; pointer-events: none; background: rgba(29, 35, 41, .92); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; display: none; z-index: 5; white-space: nowrap; }

.results { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.tabs { display: flex; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); align-items: flex-end; }
.tabs button { border-radius: 4px 4px 0 0; border-bottom: none; background: var(--bg); }
.tabs button.on { background: var(--panel); border-color: var(--line); position: relative; top: 1px; font-weight: 600; }
.tabs .spacer { flex: 1; }
.tabs .sel-name { color: var(--accent); font-weight: 600; margin-right: 8px; align-self: center; }
.tab-body { padding: 12px; display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.busy { color: var(--muted); padding: 20px; }

table.res { border-collapse: collapse; font-size: 12.5px; min-width: 290px; }
table.res th { text-align: left; font-weight: 600; background: #eef1f4; padding: 4px 8px; border-bottom: 1px solid var(--line); }
table.res td { padding: 3px 8px; border-bottom: 1px solid #edf0f2; }
table.res td.v { text-align: right; font-variant-numeric: tabular-nums; }
table.res td.u { color: var(--muted); }
table.res tr[title] td:first-child { text-decoration: underline dotted #aab; text-underline-offset: 3px; }
.note { font-size: 11.5px; color: var(--muted); max-width: 520px; line-height: 1.45; margin: 6px 0; }
.note.warn { color: var(--warn); }
.muted { color: var(--muted); }
.col { display: flex; flex-direction: column; gap: 8px; }

.tiles { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 8px; width: 100%; }
.tile { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.tile .t-l { font-size: 11.5px; color: var(--muted); }
.tile .t-v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .t-v span { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }

/* Diagramme */
svg.chart { font-family: inherit; overflow: visible; }
.c-grid { stroke: #e7eaee; stroke-width: 1; }
.c-frame { fill: none; stroke: #b9c0c8; stroke-width: 1; }
.c-tick { font-size: 10px; fill: var(--muted); }
.c-label { font-size: 10.5px; fill: var(--muted); }
.c-title { font-size: 12px; font-weight: 600; fill: var(--ink); }
.c-line { fill: none; stroke: var(--rr); stroke-width: 1.2; }
.c-dot { fill: var(--rr); fill-opacity: .55; }
.c-dot.a1 { fill: var(--rr); fill-opacity: 1; }
.c-dot.a2 { fill: var(--sns); fill-opacity: 1; }
.c-fit { stroke-width: 1.6; }
.c-fit.a1 { stroke: var(--rr); }
.c-fit.a2 { stroke: var(--sns); }
.c-note { font-size: 11px; fill: var(--ink); }
.c-note.a1 { fill: var(--rr); }
.c-note.a2 { fill: var(--sns); }
.c-note.resp { fill: var(--resp); }
.c-bar { fill: var(--rr); fill-opacity: .8; }
.c-vlf { fill: var(--vlf); }
.c-lf { fill: var(--lf); fill-opacity: .8; }
.c-hf { fill: var(--hf); fill-opacity: .9; }
.c-resp { stroke: var(--resp); stroke-width: 1.4; stroke-dasharray: 5 3; }
.c-diag { stroke: #b9c0c8; stroke-width: 1; stroke-dasharray: 3 3; }
.c-ellipse { fill: none; stroke: var(--sns); stroke-width: 1.5; }
.c-sd1 { stroke: var(--resp); stroke-width: 2; }
.c-sd2 { stroke: var(--sns); stroke-width: 2; }
.c-band { fill-opacity: .18; }
.c-band.on { fill-opacity: .35; }
.ans { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: flex-start; }
.ans-low { fill: var(--low); }
.ans-norm { fill: var(--norm); }
.ans-high { fill: var(--high); }
.ans-title { font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.ans-mark.pns, .ans-part.pns { fill: var(--pns); }
.ans-mark.sns, .ans-part.sns { fill: var(--sns); }

dialog { border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; }
dialog h3 { margin-top: 0; }
dialog .form { grid-template-columns: 110px 180px; font-size: 13px; }

/* Zeitverlauf */
.tv-hr { fill: none; stroke: #1d4f8f; stroke-width: 1.1; }
.tv-pns { fill: var(--pns); fill-opacity: .35; stroke: var(--pns); stroke-width: .8; }
.tv-sns { fill: var(--sns); fill-opacity: .35; stroke: var(--sns); stroke-width: .8; }
.tv-thr { stroke: #b0302a; stroke-width: 1.2; stroke-dasharray: 6 3; }
.tv-thr-v { stroke: #b0302a; stroke-width: 1.5; }
.c-note.thr { fill: #b0302a; }
.tv-resp { fill: none; stroke: #2e8b3d; stroke-width: 1.6; }
.tv-band { stroke: #6b7280; stroke-width: .7; stroke-dasharray: 3 3; }
.tv-alpha { fill: none; stroke: #1d4f8f; stroke-width: 1.2; }
.tv-alpha-dot { fill: #1d4f8f; }
.tv-rmssd { fill: none; stroke: #8a8f96; stroke-width: 1; }
.tv-zone-a { fill: #f6d9b8; fill-opacity: .5; }
.tv-zone-b { fill: #f2b8b0; fill-opacity: .45; }
.tv-lf { fill: none; stroke: #d58a2e; stroke-width: 1.2; }
.tv-hf { fill: none; stroke: #2f6db5; stroke-width: 1.2; }
.c-note.lf { fill: #d58a2e; }
.c-note.hf { fill: #2f6db5; }
.tv-alt { fill: #cfd6de; fill-opacity: .6; }
.tv-alt-line { fill: none; stroke: #6b7280; stroke-width: 1; }
.tv-bar-ok { fill: #4d93d1; }
.tv-bar-mid { fill: #e58a2c; }
.tv-bar-hi { fill: #d2402f; }
.tv-chip { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tv-sharebar { display: inline-block; width: 110px; height: 10px; background: #eef1f4; vertical-align: -1px; }
.tv-sharebar span { display: block; height: 100%; }
.tv-table { min-width: 0 !important; }
.tv-legend span { display: inline-block; width: 14px; height: 10px; border: 1px solid #ccc; margin: 0 2px 0 6px; vertical-align: -1px; }
.tv-summary { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 8px; width: 100%; }
.tv-box { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
.tv-box .t-l { font-size: 11.5px; color: var(--muted); }
.tv-box .t-v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tv-box .t-v span { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.tv-box .t-s { font-size: 11px; color: var(--muted); }
.tv-box.pns { border-left: 4px solid var(--pns); }
.tv-box.sns { border-left: 4px solid var(--sns); }
.tv-col { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.tv-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.tv-table td:first-child { white-space: nowrap; }
.tv-table td.v { white-space: nowrap; }
.tv-resp-dot { fill: #2e8b3d; }
/* Im Hauptschirm schrumpfen die Bilder mit dem Fenster; viewBox hält die Verhältnisse. */
.tab-body svg.chart { max-width: 100%; height: auto; }
.tab-body .tv-summary { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.tab-body .tiles { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
main { overflow-x: hidden; }
.tabs { flex-wrap: wrap; row-gap: 4px; }
