:root {
  --primary: #3b82f6;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  color-scheme: dark;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color: #e2e8f0;
  background-color: #0b0f1a;
  --app-viewport-height: 100vh;
}

@supports (height: 100dvh) {
  :root {
    --app-viewport-height: 100dvh;
  }
}

:root[data-theme="light"] {
  --primary: #2563eb;
  --text: #0f172a;
  --text-muted: #64748b;
  color-scheme: light;
  color: #0f172a;
  background-color: #e2e8f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: var(--app-viewport-height);
}

.app-main {
  flex: 1;
  display: flex;
  position: relative;
  min-height: var(--app-viewport-height);
}

.map-panel {
  flex: 1;
  position: relative;
  display: flex;
  min-height: var(--app-viewport-height);
}

.map {
  width: 100%;
  height: 100%;
  min-height: var(--app-viewport-height);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  z-index: 0;
}

.app-logo {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  padding: 8px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  font-weight: 800;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.01em;
}

.app-logo__beta {
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 6px;
}

.app-logo__info-btn {
  background: none;
  border: none;
  color: var(--primary, #3b82f6);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-logo__info-btn:hover {
  transform: scale(1.2) rotate(5deg);
}

:root[data-theme="light"] .app-logo {
  background: rgba(248, 250, 252, 0.9);
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.sidebar {
  position: absolute;
  top: 0;
  width: 360px;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: visible;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar--left {
  left: 0;
  width: 260px;
}

#sidebar-right {
  right: 0;
}

#sidebar-left {
  left: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar-left .sidebar__inner {
  height: auto;
  max-height: calc(var(--app-viewport-height) - 40px);
  margin-left: 15px;
  border-radius: 20px;
  border: 1px solid rgba(200, 200, 200, 0.2);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  transition: margin 0.3s ease, opacity 0.2s ease;
}

#sidebar-left.is-collapsed .sidebar__inner {
  margin-left: 0;
}

.sidebar.is-collapsed {
  width: 0;
  min-width: 0;
  border-left: none;
}

.sidebar__inner {
  width: 360px;
  height: 100%;
  background: rgba(0, 0, 0, 0.97);
  border-left: 1px solid rgba(200, 200, 200, 0.2);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.sidebar--left .sidebar__inner {
  width: 260px;
  border-left: 1px solid rgba(200, 200, 200, 0.2);
  border-right: 1px solid rgba(200, 200, 200, 0.2);
}

.sidebar.is-collapsed .sidebar__inner {
  opacity: 0;
  pointer-events: none;
}

.sidebar__toggle {
  position: absolute;
  top: 50%;
  left: -28px;
  transform: translateY(-50%);
  width: 28px;
  height: 60px;
  background: rgba(0, 0, 0, 0.97);
  border: 1px solid rgba(200, 200, 200, 0.2);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.sidebar--left .sidebar__toggle {
  left: auto;
  right: -28px;
  border-right: 1px solid rgba(200, 200, 200, 0.2);
  border-left: none;
  border-radius: 0 8px 8px 0;
}

.sidebar__toggle:hover {
  background: rgba(30, 41, 59, 1);
  color: #f8fafc;
}

.sidebar__toggle-icon {
  transition: transform 0.3s ease;
  display: inline-block;
}

.sidebar.is-collapsed .sidebar__toggle-icon {
  transform: rotate(180deg);
}

.sidebar--left .sidebar__toggle-icon {
  transform: rotate(180deg);
}

.sidebar--left.is-collapsed .sidebar__toggle-icon {
  transform: rotate(0deg);
}

.sidebar__nav {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(200, 200, 200, 0.1);
  flex-shrink: 0;
}

.sidebar__nav-item {
  flex: 1;
  padding: 14px 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(200, 200, 200, 0.7);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar__nav-item:hover {
  color: #f8fafc;
  background: rgba(200, 200, 200, 0.08);
}

.sidebar__nav-item.is-active {
  color: #f8fafc;
  border-bottom-color: #f8fafc;
  background: rgba(248, 250, 252, 0.1);
}

.sidebar__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.sidebar__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.sidebar__title-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar__id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.6rem;
  color: rgba(200, 200, 200, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar__id-label {
  font-size: 0.55rem;
}

.sidebar__id-value {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.65rem;
  color: rgba(226, 232, 240, 0.7);
  word-break: break-all;
}

.sidebar__content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 20px 20px 24px;
}

.sidebar__main-content.is-empty .sidebar__stop-details,
.sidebar__main-content.is-empty .sidebar__lines-details-wrapper {
  display: none;
}

.sidebar__main-content:not(.is-empty) .sidebar__placeholder {
  display: none;
}

.sidebar__main-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.sidebar__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 20px;
  text-align: center;
  gap: 24px;
}

.sidebar__placeholder-text {
  font-size: 1.1rem;
  color: rgba(200, 200, 200, 0.8);
  margin: 0;
  font-weight: 500;
}

.sidebar__placeholder-animation {
  position: relative;
  width: 120px;
  height: 120px;
  background: rgba(200, 200, 200, 0.05);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(200, 200, 200, 0.2);
}

.animation-mixed {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.animation-mixed-point {
  width: 12px;
  height: 12px;
  background-color: #fbbf24;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
  position: absolute;
  animation: mixed-pulse-point 4s infinite;
}

.animation-mixed-line {
  width: 40px;
  height: 4px;
  background-color: #fbbf24;
  border-radius: 2px;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
  position: absolute;
  opacity: 0;
  animation: mixed-pulse-line 4s infinite;
}

.animation-cursor {
  position: absolute;
  font-size: 2rem;
  z-index: 1;
  pointer-events: none;
  animation: click-animation 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

@keyframes mixed-pulse-point {
  0%, 45% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7); }
  22% { transform: scale(1.2); box-shadow: 0 0 0 10px rgba(251, 191, 36, 0); }
  50%, 100% { transform: scale(1); opacity: 0; box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

@keyframes mixed-pulse-line {
  0%, 50% { transform: scale(1); opacity: 0; box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
  55%, 95% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7); }
  75% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(251, 191, 36, 0); }
  100% { transform: scale(1); opacity: 0; box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

@keyframes click-animation {
  0% { transform: translate(40px, 40px); }
  45% { transform: translate(5px, 5px); }
  50% { transform: translate(0, 0) scale(0.8); }
  55% { transform: translate(5px, 5px) scale(1); }
  100% { transform: translate(40px, 40px); }
}

.sidebar__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.sidebar__label {
  font-size: 0.85rem;
  color: rgba(200, 200, 200, 0.9);
}

.sidebar__value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f8fafc;
}

.sidebar__stats-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.sidebar__stat-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.4);
  border-radius: 12px;
  border: 1px solid rgba(200, 200, 200, 0.1);
  transition: transform 0.2s ease, background 0.2s ease;
}

.sidebar__stat-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar__stat-item:hover {
  background: rgba(30, 41, 59, 0.6);
  transform: translateY(-2px);
}

.sidebar__stat-item--rank {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.2);
}

.sidebar__stat-item--rank .sidebar__stat-label {
  color: #fbbf24;
}

.sidebar__stat-item--rank .sidebar__stat-value {
  color: #fcd34d;
}

.sidebar__stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(200, 200, 200, 0.8);
}

.sidebar__stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}

.sidebar__footer {
  display: none;
}

.sidebar__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 12px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(200, 200, 200, 0.12);
  flex-shrink: 0;
}

.sidebar__section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(200, 200, 200, 0.8);
  margin-bottom: 2px;
}

.sidebar__section--id {
  margin-top: 8px;
  padding: 10px 12px;
}

.sidebar__section--id .sidebar__section-title {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

.sidebar__section--id .sidebar__label,
.sidebar__section--id .sidebar__value {
  font-size: 0.7rem;
}

.sidebar__section--id .sidebar__value {
  color: rgba(226, 232, 240, 0.7);
  word-break: break-all;
}

.sidebar__section--network {
  gap: 12px;
}

.sidebar__lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar__lines-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(200, 200, 200, 0.8);
}

.sidebar__lines-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.sidebar__percent-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  color: rgba(200, 200, 200, 0.6);
  cursor: help;
}

.sidebar__info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(200, 200, 200, 0.15);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.sidebar__info-icon:hover {
  background: rgba(200, 200, 200, 0.3);
}

.sidebar__lines-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sidebar__content--stops .sidebar__lines-list {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 2px;
  margin-top: 8px;
}

.sidebar__content--stops .sidebar__line-row {
  width: 100%;
}

.sidebar__line-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.sidebar__line-row:hover {
  background: rgba(200, 200, 200, 0.08);
  border-color: rgba(200, 200, 200, 0.1);
}

.sidebar__line-row:active {
  transform: scale(0.98);
}

.sidebar__line-row .sidebar__line-chip {
  flex-shrink: 0;
  min-width: 42px;
  pointer-events: none; /* Klick geht auf die Row */
}

.sidebar__line-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar__line-percent-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.72rem;
  color: rgba(200, 200, 200, 0.8);
}

.sidebar__line-label {
  font-weight: 500;
}

.sidebar__line-percent-value {
  font-weight: 700;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}

.sidebar__line-progress-bg {
  height: 4px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  overflow: hidden;
}

.sidebar__line-progress-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar__line-chip {
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  color: #0f172a;
  background: rgba(226, 232, 240, 0.9);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sidebar__line-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.sidebar__line-chip.is-active {
  outline: 2px solid rgba(248, 250, 252, 0.9);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
}

.sidebar__line-chip.is-night.is-active {
  outline: 2px solid #fbbf24;
}

.sidebar__lines-count {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(200, 200, 200, 0.2);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.8);
}

.sidebar__line-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f8fafc;
}

.sidebar__line-details {
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(200, 200, 200, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar__line-details-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.8);
}

.sidebar__line-details-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar__line-details-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar__line-details-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.sidebar__line-details-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(200, 200, 200, 0.8);
}

.sidebar__line-details-value {
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

:root[data-theme="light"] .sidebar__inner {
  background: rgba(248, 250, 252, 0.98);
  border-left-color: rgba(0, 0, 0, 0.12);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.12);
}

:root[data-theme="light"] #sidebar-left .sidebar__inner {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
}

:root[data-theme="light"] .sidebar--left .sidebar__inner {
  border-left-color: rgba(0, 0, 0, 0.12);
  border-right-color: rgba(0, 0, 0, 0.12);
}

:root[data-theme="light"] .sidebar__toggle {
  background: rgba(248, 250, 252, 0.98);
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.12);
}

:root[data-theme="light"] .sidebar__close {
  border-color: rgba(0, 0, 0, 0.25);
}

:root[data-theme="light"] .sidebar__section {
  background: rgba(226, 232, 240, 0.7);
  border-color: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .sidebar__id-value {
  color: rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] .sidebar__line-chip {
  color: #0f172a;
  background: rgba(226, 232, 240, 0.95);
}

:root[data-theme="light"] .sidebar__line-details {
  background: rgba(248, 250, 252, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .sidebar__lines-count {
  background: rgba(226, 232, 240, 0.9);
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.7);
}

:root[data-theme="light"] .sidebar__line-count {
  color: #0f172a;
}


:root[data-theme="light"] .sidebar__stat-item {
  background: rgba(226, 232, 240, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .sidebar__stat-value {
  color: #0f172a;
}

:root[data-theme="light"] .sidebar__stat-item--rank {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.2);
}

:root[data-theme="light"] .sidebar__stat-item--rank .sidebar__stat-label {
  color: #b45309;
}

:root[data-theme="light"] .sidebar__stat-item--rank .sidebar__stat-value {
  color: #92400e;
}

:root[data-theme="light"] .sidebar__stat-label {
  color: rgba(0, 0, 0, 0.7);
}

.sidebar__display-options {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 10px;
}

.sidebar__display-btn {
  flex: 1;
  padding: 8px 4px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(200, 200, 200, 0.7);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar__display-btn:hover {
  color: #f8fafc;
  background: rgba(200, 200, 200, 0.08);
}

.sidebar__display-btn.is-active {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .sidebar__display-options {
  background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .sidebar__display-btn {
  color: rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] .sidebar__display-btn.is-active {
  background: rgba(255, 255, 255, 0.8);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar__heatmap-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 10px;
}

.sidebar__heatmap-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__heatmap-group-title {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(200, 200, 200, 0.4);
  font-weight: 700;
  padding: 6px 10px 2px;
}

.sidebar__heatmap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 4px;
}

.sidebar__standard-btn,
.sidebar__heatmap-btn {
  flex: 1;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(200, 200, 200, 0.7);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.sidebar__standard-btn:hover,
.sidebar__heatmap-btn:hover {
  color: #f8fafc;
  background: rgba(200, 200, 200, 0.08);
}

.sidebar__standard-btn.is-active,
.sidebar__heatmap-btn.is-active {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .sidebar__heatmap-options {
  background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .sidebar__heatmap-group-title {
  color: rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] .sidebar__heatmap-btn {
  color: rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] .sidebar__heatmap-btn.is-active {
  background: rgba(255, 255, 255, 0.8);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Heatmap Legend */
.heatmap-legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(200, 200, 200, 0.2);
  width: 180px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none; /* Klicks durchlassen zur Karte */
}

:root[data-theme="light"] .heatmap-legend {
  background: rgba(248, 250, 252, 0.9);
  color: #0f172a;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.heatmap-legend__title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(200, 200, 200, 0.8);
  font-weight: 700;
}

:root[data-theme="light"] .heatmap-legend__title {
  color: rgba(0, 0, 0, 0.6);
}

.heatmap-legend__gradient {
  height: 8px;
  width: 100%;
  border-radius: 4px;
  background: linear-gradient(to right, rgb(59, 130, 246), rgb(239, 68, 68));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.heatmap-legend__labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.heatmap-legend__labels span {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
}

.heatmap-legend__labels span::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
}

.heatmap-legend__labels span:first-child {
  align-items: flex-start;
}
.heatmap-legend__labels span:first-child::before {
  left: 0;
}

.heatmap-legend__labels span:last-child {
  align-items: flex-end;
}
.heatmap-legend__labels span:last-child::before {
  left: auto;
  right: 0;
}

:root[data-theme="light"] .heatmap-legend__labels span::before {
  background: rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .heatmap-legend__labels {
  color: #0f172a;
}

/* Screen size warning */
.screen-error {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background-color: #0b0f1a;
  color: #f8fafc;
  padding: 40px;
  text-align: center;
  align-items: center;
  justify-content: center;
}

.screen-error__content {
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.screen-error__icon {
  font-size: 4rem;
}

.screen-error__title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
}

.screen-error__text {
  margin: 0;
  line-height: 1.6;
  color: #94a3b8;
}

@media (max-width: 767px) {
  .screen-error {
    display: flex;
  }
  
  /* Prevent scrolling when error is shown */
  body {
    overflow: hidden;
  }
}

/* New Sidebar Components */
.sidebar__scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px;
  margin-top: 10px;
}

.sidebar__title-block {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.sidebar__badge-rank {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
  white-space: nowrap;
}

.sidebar__line-badge {
  background: #3b82f6;
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sidebar__stat-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.2s ease;
}

.sidebar__stat-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar__stat-icon {
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.sidebar__stat-content {
  display: flex;
  flex-direction: column;
}

.sidebar__balance-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar__balance-header {
  display: flex;
  justify-content: center;
}

.sidebar__balance-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
}

.sidebar__balance-stats {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.sidebar__balance-info {
  display: flex;
  flex-direction: column;
}

.sidebar__balance-info.is-right {
  align-items: flex-end;
}

.sidebar__balance-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
}

.sidebar__balance-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
}

.sidebar__balance-bar-container {
  width: 100%;
}

.sidebar__balance-bar {
  height: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
}

.sidebar__balance-fill {
  height: 100%;
  display: flex;
  align-items: center;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0 8px;
  min-width: 40px;
}

.sidebar__balance-fill.is-in {
  background: #10b981;
  justify-content: flex-start;
}

.sidebar__balance-fill.is-out {
  background: #ef4444;
  justify-content: flex-end;
}

.sidebar__balance-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sidebar__stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: #f8fafc;
}

.sidebar__stat-label {
  font-size: 0.65rem;
  color: rgba(200, 200, 200, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Ratio Bar */
.sidebar__ratio-container {
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.2);
  padding: 15px;
  border-radius: 14px;
}

.sidebar__ratio-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(200, 200, 200, 0.6);
  margin-bottom: 8px;
}

.sidebar__ratio-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  margin-bottom: 8px;
}

.sidebar__ratio-in {
  background: #3b82f6;
  height: 100%;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar__ratio-out {
  background: #ef4444;
  height: 100%;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar__ratio-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
}

.sidebar__in-val, .sidebar__line-in-val { color: #60a5fa; }
.sidebar__out-val, .sidebar__line-out-val { color: #f87171; }

/* Meta Grid */
.sidebar__meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sidebar__meta-item {
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 8px;
}

.sidebar__meta-label {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  color: rgba(200, 200, 200, 0.4);
  margin-bottom: 2px;
}

/* Line stops list */
.sidebar__line-stops-container {
  position: relative;
  padding-left: 20px;
}

.sidebar__line-path {
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.sidebar__section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sidebar__sort-controls {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px;
  border-radius: 8px;
}

.sidebar__sort-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.65rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.sidebar__sort-btn:hover {
  color: rgba(255, 255, 255, 0.8);
}

.sidebar__sort-btn.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sidebar__line-stop-item {
  position: relative;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar__line-stop-main {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.sidebar__line-stop-item:hover {
  transform: translateX(5px);
}

.sidebar__line-stop-bar-container {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
  margin-left: 0;
}

.sidebar__line-stop-bar {
  height: 100%;
  background: #3b82f6;
  border-radius: 2px;
  opacity: 0.6;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar__line-stop-dot {
  position: absolute;
  left: -19px;
  top: 13px;
  width: 12px;
  height: 12px;
  background: #3b82f6;
  border: 2px solid #0f172a;
  border-radius: 50%;
  z-index: 1;
}

.sidebar__line-stop-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.sidebar__line-stop-meta {
  margin-left: auto;
  font-size: 0.7rem;
  color: rgba(200, 200, 200, 0.5);
}

:root[data-theme="light"] .sidebar__sort-controls {
  background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .sidebar__sort-btn {
  color: rgba(0, 0, 0, 0.4);
}

:root[data-theme="light"] .sidebar__sort-btn.is-active {
  background: #fff;
  color: #0f172a;
}

:root[data-theme="light"] .sidebar__line-stop-bar-container {
  background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .sidebar__line-stop-dot {
  border-color: #fff;
}

:root[data-theme="light"] .sidebar__line-stop-name {
  color: #0f172a;
}

:root[data-theme="light"] .sidebar__line-stop-meta {
  color: rgba(0, 0, 0, 0.4);
}

:root[data-theme="light"] .sidebar__line-path {
  background: rgba(0, 0, 0, 0.05);
}

.sidebar__lines-footer {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: rgba(200, 200, 200, 0.5);
  text-align: center;
}

.sidebar__line-count {
  font-weight: 700;
  color: #f8fafc;
}

:root[data-theme="light"] .sidebar__stat-card {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .sidebar__balance-card {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .sidebar__balance-title,
:root[data-theme="light"] .sidebar__balance-label {
  color: rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] .sidebar__balance-num {
  color: #0f172a;
}
:root[data-theme="light"] .sidebar__stat-value {
  color: #0f172a;
}
:root[data-theme="light"] .sidebar__ratio-container {
  background: rgba(0, 0, 0, 0.03);
}
:root[data-theme="light"] .sidebar__badge-rank {
  background: rgba(251, 191, 36, 0.1);
}
:root[data-theme="light"] .sidebar__meta-item {
  background: rgba(0, 0, 0, 0.03);
}

/* --- Search Components --- */
.search-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  width: 100%;
  max-width: 450px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  padding: 8px 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-bar:focus-within {
  background: #1e293b;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
  border-color: #3b82f6;
}

.search-bar__icon {
  font-size: 1.1rem;
  opacity: 0.6;
}

.search-bar__input {
  border: none;
  background: transparent;
  flex: 1;
  font-size: 1rem;
  padding: 8px 12px;
  outline: none;
  color: #f8fafc;
  min-width: 0;
}

.search-bar__input::placeholder {
  color: #94a3b8;
}

.search-bar__clear {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}

.search-bar__clear:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

.search-results {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-height: 450px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: searchSlideInDown 0.2s ease-out;
}

@keyframes searchSlideInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-result-group {
  padding: 12px 0;
}

.search-result-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0 16px 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.search-result-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.search-result-item:hover, .search-result-item.is-selected {
  background: rgba(59, 130, 246, 0.2);
}

.search-result-item__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
}

.search-result-item__content {
  flex: 1;
}

.search-result-item__title {
  font-weight: 600;
  color: #f8fafc;
  font-size: 0.95rem;
}

.search-result-item__subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
}

/* Light Mode */
:root[data-theme="light"] .search-bar {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .search-bar:focus-within {
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .search-bar__input {
  color: #0f172a;
}

:root[data-theme="light"] .search-results {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .search-result-item__title {
  color: #0f172a;
}

:root[data-theme="light"] .search-result-item:hover,
:root[data-theme="light"] .search-result-item.is-selected {
  background: rgba(59, 130, 246, 0.1);
}

/* Info Modal */
.info-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.info-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

.info-modal__content {
  position: relative;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  width: 100%;
  max-width: 550px;
  max-height: 85vh;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  padding: 32px;
  animation: modalPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPopIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.info-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: #94a3b8;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.info-modal__close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  transform: rotate(90deg);
}

.info-modal__header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.info-modal__icon {
  width: 48px;
  height: 48px;
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.info-modal__title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.info-modal__section {
  margin-bottom: 32px;
}

.info-modal__section h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #3b82f6;
  margin-bottom: 12px;
  font-weight: 700;
}

.info-modal__section p {
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 16px;
}

.info-modal__links {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}

.info-modal__links a {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  text-decoration: none;
  transition: all 0.2s;
}

.info-modal__links a:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateX(4px);
}

.info-modal__links strong {
  color: #f8fafc;
  font-size: 0.95rem;
}

.info-modal__links span {
  color: #94a3b8;
  font-size: 0.8rem;
  margin-top: 2px;
}

.info-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.info-modal__card {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-modal__card-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.info-modal__card h4 {
  color: #f8fafc;
  margin-bottom: 8px;
  font-size: 1rem;
}

.info-modal__card p {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.5;
}

.info-modal__calculation-example {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 1rem;
}

.dark .info-modal__calculation-example {
  background: rgba(255, 255, 255, 0.03);
}

.info-modal__example-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.info-modal__step-badge {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.info-modal__example-step p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.info-modal__example-step strong {
  color: var(--text);
  display: block;
  margin-bottom: 0.125rem;
}

.info-modal__footer {
  margin-top: 16px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.info-modal__footer p {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0;
}

/* Light Theme Anpassungen */
:root[data-theme="light"] .info-modal__content {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .info-modal__title {
  color: #0f172a;
}

:root[data-theme="light"] .info-modal__section p {
  color: #475569;
}

:root[data-theme="light"] .info-modal__links a {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

:root[data-theme="light"] .info-modal__links strong {
  color: #0f172a;
}

:root[data-theme="light"] .info-modal__card {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

:root[data-theme="light"] .info-modal__card h4 {
  color: #0f172a;
}

@media (max-width: 600px) {
  .info-modal__grid {
    grid-template-columns: 1fr;
  }
  .info-modal__content {
    padding: 24px;
  }
}
