/* Dunkelmodus (Standard) */
:root,
[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #1a2332;
  --header-footer-bg: #151d28;
  --border: #2d3a4d;
  --text: #e6edf3;
  --text-muted: #8b9eb0;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --link: #58a6ff;
  --chart-grid: rgba(139, 158, 176, 0.2);
  --chart-text: #8b9eb0;
  --table-head-bg: rgba(0, 0, 0, 0.2);
  --table-row-hover: rgba(59, 130, 246, 0.1);
  --table-row-selected: rgba(59, 130, 246, 0.25);
  --table-row-selected-hover: rgba(59, 130, 246, 0.35);
}

/* Hellmodus */
[data-theme="light"] {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --header-footer-bg: #e8ecf1;
  --border: #d1d9e3;
  --text: #1a2332;
  --text-muted: #5c6b7a;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --link: #2563eb;
  --chart-grid: rgba(0, 0, 0, 0.08);
  --chart-text: #5c6b7a;
  --table-head-bg: rgba(0, 0, 0, 0.05);
  --table-row-hover: rgba(37, 99, 235, 0.08);
  --table-row-selected: rgba(37, 99, 235, 0.18);
  --table-row-selected-hover: rgba(37, 99, 235, 0.28);
}

* {
  box-sizing: border-box;
}

/* Verhindert Layout-Shift („Wackeln“), wenn die Scrollbar erscheint oder verschwindet */
html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

header {
  padding: 0;
}

.header-row {
  position: relative;
  padding: 1rem 1.25rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--header-footer-bg);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
}

.header-row::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(
    to right,
    #000 0%,
    #000 33.33%,
    #dd0000 33.33%,
    #dd0000 66.66%,
    #ffcc00 66.66%,
    #ffcc00 100%
  );
}

.header-brand {
  order: -1;
  width: 100%;
  text-align: center;
}

#header-title,
.header-brand .header-title-clickable {
  margin: 0;
  text-align: center;
}

.header-tagline {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

[data-theme="dark"] .header-row::after {
  background: linear-gradient(
    to right,
    #5c6b7a 0%,
    #5c6b7a 33.33%,
    #dd0000 33.33%,
    #dd0000 66.66%,
    #ffcc00 66.66%,
    #ffcc00 100%
  );
}

.header-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.header-link {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
}

.header-link:hover {
  color: var(--accent);
}

.wahlperiode-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.wp-buttons {
  display: flex;
  gap: 0.25rem;
}

.wp-btn {
  min-width: 2.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.wp-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
}

.wp-btn-active,
.wp-btn.wp-btn-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.wp-btn-active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.theme-toggle {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.theme-icon {
  display: none;
}

[data-theme="dark"] .theme-icon-dark,
[data-theme="light"] .theme-icon-light {
  display: inline;
}

:root:not([data-theme]) .theme-icon-dark {
  display: inline;
}

:root:not([data-theme]) .theme-icon-light {
  display: none;
}

header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.header-title-clickable {
  cursor: pointer;
  user-select: none;
}

.header-title-clickable:hover {
  color: var(--accent);
}

.header-title-clickable .header-home-link {
  color: inherit;
  text-decoration: none;
}

.header-title-clickable .header-home-link:hover {
  color: var(--accent);
}

.wahlperiode {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.breadcrumb {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb span {
  color: var(--text);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumb span:hover {
  color: var(--accent);
}

.breadcrumb .separator {
  margin: 0 0.35rem;
  cursor: default;
  text-decoration: none;
  color: var(--text-muted);
}

main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  padding: 1.5rem 0;
}

.kpi-section {
  grid-row: 1;
  grid-column: 1 / -1;
  background: var(--surface);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem 2rem;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  position: relative;
}

.kpi-info {
  font-size: 0.85em;
  cursor: help;
  line-height: 1;
}

.kpi-tooltip {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 0.35rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  width: 220px;
  max-width: 90vw;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 20;
}

.kpi-label-wrap:hover .kpi-tooltip {
  opacity: 1;
  visibility: visible;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.quickstart {
  margin: 0.65rem 0 0 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.quickstart-steps {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.quickstart-steps-label {
  font-weight: 600;
  color: var(--text);
}

.quickstart-disclosure {
  margin: 0.35rem 0 0 0;
}

.quickstart-disclosure-summary {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  display: inline-block;
}

.quickstart-disclosure-summary::-webkit-details-marker {
  display: none;
}

.quickstart-disclosure-summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}

.quickstart-disclosure[open] .quickstart-disclosure-summary::before {
  transform: rotate(90deg);
}

.quickstart-disclosure-summary:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.quickstart-disclosure-body {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.quickstart-disclaimer-lead {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.45;
}

.quickstart-disclaimer-list {
  margin: 0.5rem 0 0 0;
  padding-left: 1.2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.quickstart-disclaimer-list li {
  margin: 0.25rem 0;
}

.quickstart-disclaimer-faq {
  margin: 0.5rem 0 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.quickstart-disclaimer-link {
  color: var(--accent);
  text-decoration: none;
}

.quickstart-disclaimer-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  html {
    overflow-x: hidden;
  }
  body {
    overflow-x: hidden;
  }
  html.detail-overlay-open,
  body.detail-overlay-open {
    overflow: hidden;
  }
  main {
    grid-template-columns: 1fr;
  }
  .kpi-section { grid-row: auto; }
  .filter-section { grid-row: auto; }
  .chart-section { grid-row: auto; }
  .table-section {
    grid-row: auto;
    grid-column: 1;
  }
  .detail-section {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }
  .detail-backdrop:not([hidden]) {
    display: block;
  }
  /* Bottom Sheet auf Mobil: Aktivitätsliste von unten, mit seitlichem Abstand */
  .detail-section:not([hidden]) {
    position: fixed;
    bottom: 0;
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    max-width: none;
    height: 85vh;
    max-height: 85vh;
    min-height: 0;
    border-radius: 12px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
    z-index: 51;
    border: 1px solid var(--border);
    border-bottom: none;
    padding-top: 1.75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .detail-section:not([hidden]) .detail-content {
    flex: 1 1 0;
    min-height: 0;
  }
  .detail-section:not([hidden])::before {
    content: "";
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2.5rem;
    height: 4px;
    background: var(--text-muted);
    opacity: 0.5;
    border-radius: 2px;
  }
}

@media (max-width: 480px) {
  .page-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .header-row {
    padding: 0.75rem 1rem 0.9rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .header-tagline {
    font-size: 0.8rem;
  }
  header h1 {
    font-size: 1.25rem;
  }
  .chart-container {
    height: 260px;
  }
  .chart-section,
  .filter-section,
  .table-section {
    padding: 1rem;
  }
  .kpi-section {
    padding: 0.75rem 1rem;
  }
  .kpi-grid {
    gap: 0.75rem 1rem;
  }
  .kpi-value {
    font-size: 1.1rem;
  }
  .main-footer {
    padding: 1rem 0;
  }
}

.chart-section {
  grid-row: 3;
  grid-column: 1 / -1;
  background: var(--surface);
  border-radius: 8px;
  padding: 1.25rem;
  border: 1px solid var(--border);
}

.chart-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.chart-section h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.chart-toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  padding: 2px;
}

.chart-toggle-option {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.chart-toggle-option:hover {
  color: var(--text);
  background: var(--table-row-hover);
}

.chart-toggle-option[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 360px;
}

.table-section {
  grid-row: 4;
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

main.detail-open .table-section {
  grid-column: 1;
}

.table-section h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-section {
  grid-row: 2;
  grid-column: 1 / -1;
  background: var(--surface);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
}

.filter-section h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-mode-wrap {
  margin: 0 0 0.75rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
}

.filter-mode-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.filter-mode-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  overflow: hidden;
}

.filter-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.filter-mode-btn + .filter-mode-btn {
  border-left: 1px solid var(--border);
}

.filter-mode-btn:hover {
  background: var(--table-row-hover);
  color: var(--text);
}

.filter-mode-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.filter-mode-hint {
  flex-basis: 100%;
  margin-top: 0;
  font-size: 0.8rem;
}

.person-filter-wrap,
.global-filter-wrap {
  width: 100%;
}

.filter-hint {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.personen-suche-wrap {
  margin-bottom: 1rem;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
}

.personen-suche-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.personen-suche-input-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  min-width: min(32rem, 100%);
}

.personen-suche-input {
  min-width: 16rem;
  width: 100%;
  padding: 0.42rem 0.6rem;
  font-size: 0.95rem;
  border: none;
  border-radius: 5px 0 0 5px;
  background: transparent;
  color: var(--text);
}

.personen-suche-clear {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0 5px 5px 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.personen-suche-input-wrap.has-text .personen-suche-clear {
  opacity: 1;
  pointer-events: auto;
}

.personen-suche-clear:hover {
  color: var(--text);
  background: var(--border);
}

.personen-suche-results {
  position: absolute;
  top: calc(100% - 0.35rem);
  left: 0;
  width: min(40rem, 100%);
  max-height: 18rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  z-index: 40;
}

.personen-suche-option {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.personen-suche-option:last-child {
  border-bottom: none;
}

.personen-suche-option:hover,
.personen-suche-option.is-active {
  background: var(--table-row-hover);
}

.personen-suche-name {
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 500;
}

.personen-suche-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.personen-suche-empty {
  padding: 0.55rem 0.7rem;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.stichwort-filter-wrap {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
}

.stichwort-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.stichwort-input-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.stichwort-input-wrap .stichwort-input {
  min-width: 12rem;
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  border: none;
  border-radius: 5px 0 0 5px;
  background: transparent;
  color: var(--text);
}

.stichwort-clear {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0 5px 5px 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.stichwort-input-wrap.has-text .stichwort-clear {
  opacity: 1;
  pointer-events: auto;
}

.stichwort-clear:hover {
  color: var(--text);
  background: var(--border);
}

.filter-section .filter-subhead {
  font-size: 1rem;
  font-weight: 600;
  margin: 1rem 0 0.25rem 0;
  color: var(--text-muted);
}

.filter-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

/* Wechselseitig gesperrt: Personensuche vs. globale Filter (Stichwort + Aktivitätsarten).
   Dezentes Overlay + visuelle Abblendung, ohne dass Inhalte verschoben werden. */
.filter-locked {
  position: relative;
  opacity: 0.55;
  filter: grayscale(40%);
  pointer-events: none;
  user-select: none;
}

.filter-locked::after {
  content: attr(data-locked-hint);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border-radius: 6px;
  pointer-events: auto;
  cursor: not-allowed;
}

.filter-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.filter-group {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
}

.filter-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  color: var(--text);
}

.filter-group-header:hover {
  background: var(--table-row-hover);
}

.filter-group-header .toggle-icon {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.filter-group.expanded .toggle-icon {
  transform: rotate(90deg);
}

.filter-group-items {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  padding: 0.4rem 0.75rem 0.5rem;
  border-top: 1px solid var(--border);
}

.filter-group.expanded .filter-group-items {
  display: flex;
}

.filter-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.filter-checkbox-label input {
  cursor: pointer;
  flex-shrink: 0;
}

.filter-error {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

#main-table {
  width: 100%;
  border-collapse: collapse;
}

#main-table th,
#main-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

#main-table th {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--table-head-bg, rgba(0, 0, 0, 0.2));
}

#main-table tbody tr {
  cursor: pointer;
}

#main-table tbody tr:hover {
  background: var(--table-row-hover, rgba(59, 130, 246, 0.1));
}

#main-table tbody tr.tr-selected {
  background: var(--table-row-selected, rgba(59, 130, 246, 0.2));
}

#main-table tbody tr.tr-selected:hover {
  background: var(--table-row-selected-hover, rgba(59, 130, 246, 0.3));
}

#main-table tbody tr.tr-flash {
  animation: rowFlashPulse 1.2s ease;
}

@keyframes rowFlashPulse {
  0% { box-shadow: inset 0 0 0 9999px rgba(59, 130, 246, 0.18); }
  100% { box-shadow: inset 0 0 0 9999px rgba(59, 130, 246, 0); }
}

.sortable-th {
  cursor: pointer;
  user-select: none;
}

.sortable-th:hover {
  color: var(--accent);
}

#main-table tbody tr:last-child td {
  border-bottom: none;
}

.detail-mini-chart-wrap {
  flex-shrink: 0;
  height: 100px;
  margin-bottom: 0.75rem;
}

.detail-mini-chart-wrap[aria-hidden="true"] {
  display: none;
}

#detail-mini-chart {
  width: 100% !important;
  height: 100px !important;
}

.detail-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 50;
  cursor: pointer;
}
/* Backdrop nur auf Mobil (Bottom Sheet); auf Desktop kein Overlay */

.detail-section {
  grid-row: 4;
  grid-column: 2;
  align-self: start;
  position: sticky;
  top: 1rem;
  width: 380px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateZ(0);
}

.detail-section[hidden] {
  display: none !important;
}

.detail-section h2 {
  margin: 0 2rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.close-detail {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}

.close-detail:hover {
  background: var(--border);
  color: var(--text);
}

.detail-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.detail-activity {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.detail-activity:last-child {
  border-bottom: none;
}

.detail-activity .datum {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.detail-activity .art {
  font-weight: 500;
  margin-top: 0.2rem;
}

.detail-activity .detail-thema {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.detail-activity a {
  color: var(--link);
  word-break: break-all;
}

.detail-activity a:hover {
  text-decoration: underline;
}

.detail-empty {
  color: var(--text-muted);
  font-style: italic;
}

.state-row td {
  color: var(--text-muted);
  font-style: italic;
  padding: 1rem;
}

.retry-btn {
  margin-left: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.retry-btn:hover {
  background: var(--accent-hover, #2563eb);
}

#detail-content .retry-btn {
  margin-top: 0.5rem;
}

/* FAQ / How-To Seite */
.faq-main {
  display: block;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.faq-main .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.faq-main .card:last-child {
  margin-bottom: 0;
}

.faq-section h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.faq-section p,
.faq-section ul {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
}

.faq-section ul {
  padding-left: 1.25rem;
}

.faq-section li {
  margin-bottom: 0.35rem;
}

.faq-dl {
  margin: 0;
}

.faq-dl dt {
  font-weight: 600;
  margin-top: 0.75rem;
  color: var(--text);
}

.faq-dl dt:first-child {
  margin-top: 0;
}

.faq-dl dd {
  margin: 0.25rem 0 0 0;
  padding-left: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.faq-donate .donate-link-wrap {
  margin-top: 0.75rem;
}

.donate-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: background 0.2s;
}

.donate-btn:hover {
  background: var(--accent-hover, #2563eb);
}

.donate-notice {
  margin: 0.85rem 0 0.35rem 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.donate-notice-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.donate-notice-list li {
  margin: 0.3rem 0;
}

.donate-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.donate-hint code {
  font-size: 0.85em;
  padding: 0.1rem 0.3rem;
  background: var(--bg);
  border-radius: 4px;
}

.main-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem 0.75rem;
  padding: 1.25rem 0;
  margin-top: 0.5rem;
  background: var(--header-footer-bg);
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
}

.footer-last-update {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-sep {
  color: var(--text-muted);
  font-weight: 300;
}

.footer-link {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--accent);
}

.impressum-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
