:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-alt: #172033;
  --border: #334155;
  --text: #e2e8f0;
  --heading: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-1: #6366f1;
  --accent-2: #8b5cf6;
  --success: #22c55e;
  --error: #f87171;
  --font: "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  padding: 2rem 2rem 1.2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

header h1 { font-size: 1.6rem; margin-bottom: .4rem; color: var(--heading); }
.subtitle { color: var(--text-muted); font-size: .9rem; }

main { padding: 2rem; max-width: 1400px; margin: 0 auto; }

/* --- Ladebereich / Dropzone --- */
#ladeBereich {
  background: var(--panel);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, .4);
}

.typ-auswahl {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.2rem;
}
.typ-btn {
  width: auto;
  margin-top: 0;
  padding: .6rem 1.1rem;
  font-size: .88rem;
  font-weight: 600;
  background: var(--panel-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.typ-btn:hover { opacity: 1; color: var(--text); border-color: var(--accent-1); }
.typ-btn.aktiv {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

#dropzone {
  border: 2px dashed var(--border);
  border-radius: .6rem;
  padding: 2rem 1.2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
#dropzone:hover { border-color: var(--accent-1); }
#dropzone.dragover { border-color: var(--accent-1); background: rgba(99, 102, 241, .08); }
#dropzone.has-file { border-color: var(--success); border-style: solid; }
#dropzone .file-icon { font-size: 1.8rem; margin-bottom: .4rem; }
#dropzone p { margin: 4px 0; color: var(--text); }
#dropzone strong { color: var(--heading); }
.hinweis { color: var(--text-dim); font-size: .85rem; }
.hinweis code { color: var(--text-muted); }

#dateiInfo { color: var(--text-muted); margin-top: 1rem; font-size: .88rem; text-align: center; }

/* --- Filterbereich --- */
#filterBereich {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
  align-items: start;
}
#filterBereich[hidden] { display: none; }

.filter-spalte, .ergebnis-spalte { min-width: 0; }

.filter-spalte {
  background: var(--panel);
  border-radius: 1rem;
  padding: 1.6rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, .4);
}

.filter-spalte h2 {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 1.4rem 0 .6rem;
}
.filter-spalte h2:first-child { margin-top: 0; }

#regelListe { display: flex; flex-direction: column; gap: .5rem; }

.regel-checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: .5rem;
  cursor: pointer;
  font-size: .88rem;
  transition: border-color .15s;
}
.regel-checkbox:hover { border-color: var(--accent-1); }
.regel-punkt { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

#suchfeld {
  width: 100%;
  padding: .7rem .8rem;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: .5rem;
  color: var(--text);
  font-size: .88rem;
}
#suchfeld::placeholder { color: var(--text-dim); }
#suchfeld:focus { outline: none; border-color: var(--accent-1); }

.zeit-filter { min-width: 0; }
.zeit-filter[hidden] { display: none; }

.zeit-eingaben {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: .8rem;
}
.zeit-eingaben label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-muted);
}
.zeit-eingaben input[type="datetime-local"] {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: .5rem .6rem;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: .5rem;
  color: var(--text);
  font-size: .78rem;
  color-scheme: dark;
}
.zeit-eingaben input[type="datetime-local"]:focus { outline: none; border-color: var(--accent-1); }

.zeit-slider-wrapper {
  position: relative;
  height: 28px;
  margin-bottom: .6rem;
}
.zeit-slider-track-bg {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.zeit-slider-track-fill {
  position: absolute;
  top: 12px;
  height: 4px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 2px;
}
.zeit-slider-wrapper input[type="range"] {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  margin: 0;
  height: 28px;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.zeit-slider-wrapper input[type="range"]::-webkit-slider-runnable-track {
  background: transparent;
  height: 4px;
}
.zeit-slider-wrapper input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  margin-top: 6px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent-1);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.zeit-slider-wrapper input[type="range"]::-moz-range-track { background: transparent; height: 4px; }
.zeit-slider-wrapper input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent-1);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.zeit-reset-btn { margin-top: 0; margin-bottom: 1.4rem; font-size: .8rem; padding: .4rem .8rem; }

.komponenten-aktionen { display: flex; gap: .5rem; margin-bottom: .6rem; }
.komponenten-aktionen button { font-size: .8rem; padding: .35rem .8rem; margin-top: 0; }

.komponenten-liste {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: .5rem;
  background: var(--panel-alt);
}
.komponente-checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  padding: .25rem .3rem;
  cursor: pointer;
  border-radius: .3rem;
}
.komponente-checkbox:hover { background: rgba(148, 163, 184, .08); }
.komponente-checkbox small { color: var(--text-dim); }

input[type="checkbox"] { accent-color: var(--accent-1); }

button {
  width: 100%;
  padding: .8rem;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border: none;
  border-radius: .6rem;
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: .5rem;
  transition: opacity .2s, transform .1s;
}
button:hover { opacity: .9; transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: .5; cursor: not-allowed; }

button.sekundaer {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}
button.sekundaer:hover { opacity: 1; border-color: var(--accent-1); background: rgba(99, 102, 241, .08); }

#zuruecksetzenBtn { margin-top: 1.2rem; }

/* --- Ergebnisspalte --- */
.statistik-bereich {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.statistik-bereich[hidden] { display: none; }
.statistik-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: .8rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .3);
}
.statistik-box h4 { margin: 0 0 .6rem; font-size: .85rem; }
.statistik-box ul { list-style: none; font-size: .85rem; }
.statistik-box li {
  display: flex;
  justify-content: space-between;
  padding: .2rem 0;
  color: var(--text);
}
.statistik-box code {
  font-size: .8rem;
  color: var(--text-muted);
  background: var(--panel-alt);
  padding: 1px 5px;
  border-radius: 4px;
}

.export-leiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .8rem;
  margin-bottom: .8rem;
  background: var(--panel);
  border-radius: .8rem;
  padding: .9rem 1.1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .3);
}
.export-leiste p { margin: 0; margin-right: auto; font-size: .88rem; color: var(--text-muted); }
.export-leiste button { width: auto; margin-top: 0; padding: .6rem 1rem; font-size: .85rem; }
.kompakt-label { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text-muted); }

.tabellen-wrapper {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: .8rem;
  overflow: auto;
  max-height: 60vh;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .3);
}

table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  position: sticky;
  top: 0;
  background: var(--panel-alt);
  text-align: left;
  padding: .7rem .8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .04em;
  z-index: 1;
}
tbody tr { border-left: 4px solid transparent; border-bottom: 1px solid rgba(51, 65, 85, .5); }
tbody tr:hover { background: rgba(99, 102, 241, .06); }
tbody td { padding: .5rem .8rem; vertical-align: top; }
.col-zeit { white-space: nowrap; color: var(--text-dim); font-family: Consolas, monospace; font-size: .78rem; }
.col-komponente { white-space: nowrap; font-weight: 600; color: var(--text-muted); }
.col-nachricht { word-break: break-word; white-space: pre-wrap; font-family: Consolas, monospace; font-size: .8rem; color: var(--text); }

#mehrLadenBtn { margin-top: .8rem; }

@media (max-width: 900px) {
  #filterBereich { grid-template-columns: 1fr; }
}
