/* Topbar — Höhe --topbar-h, sticky (Wrapper in shell.css), View-Titel links,
   Zeitraum-Pills + Autoplay + CSV/Refresh/Sync rechts. */
.topbar {
  /* Höhe wächst, wenn die Controls auf einem schmalen Desktop umbrechen müssen
     (statt horizontal zu überlaufen) — auf breiten Monitoren bleibt es eine Zeile. */
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 8px 32px;
  background: color-mix(in oklab, var(--bg-base) 82%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.tb-left {
  min-width: 0;
  flex: 1 1 auto;
}
.tb-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--t-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
/* Aktions-Gruppe (Suche/Refresh/Sync/CSV) — rechtsbündig; bei Umbruch eigene Zeile rechts. */
.tb-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  margin-left: auto;
}

/* ── Zeitraum: einzelne Preset-Pills (aktiver hervorgehoben) + Custom-Range ── */
.tb-range {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tb-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
}
.tb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: calc(var(--r-md) - 2px);
  color: var(--t-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tb-pill:hover {
  color: var(--t-bright);
  background: var(--bg-elev-2);
}
.tb-pill.active {
  color: var(--accent);
  background: var(--accent-soft-bg);
  border-color: var(--accent-line);
}
.tb-pill:focus-visible {
  outline: none;
  border-color: var(--border-focus);
}

.tb-custom {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tb-dash {
  color: var(--t-muted);
}
/* Apply-Pill steht außerhalb des Pill-Containers → eigene Fläche, gleiche Optik. */
.tb-apply {
  height: 34px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
}
.tb-apply:hover {
  background: var(--bg-elev-2);
}

.tb-select,
.tb-date {
  height: 34px;
  padding: 0 10px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  color: var(--t-bright);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.tb-select:focus,
.tb-date:focus {
  border-color: var(--border-focus);
}
.tb-select-sm {
  height: 30px;
  font-size: 12px;
}

/* ── Autoplay (Wallboard-Modus): Toggle-Pill + 2 Dropdowns ── */
.tb-autoplay {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tb-autoplay-toggle {
  height: 34px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
}
.tb-autoplay-toggle:hover {
  background: var(--bg-elev-2);
}
.tb-autoplay-toggle.active {
  color: var(--accent);
  background: var(--accent-soft-bg);
  border-color: var(--accent-line);
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  background: var(--accent-soft-bg);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.tb-btn:hover:not(:disabled) {
  background: color-mix(in oklab, var(--accent) 16%, transparent);
  border-color: var(--accent);
}
.tb-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tb-ico {
  width: 15px;
  height: 15px;
}

/* ── Mobil (@720): volle Bildschirmbreite nutzen, klar geordnet ──
   Zeile 1: Titel + Aktions-Icons (Suche/Refresh/CSV) · Zeile 2: Zeitraum (volle Breite)
   · Zeile 3: Autoplay (volle Breite). Größere Touch-Targets. */
@media (max-width: 720px) {
  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 16px 12px; /* volle Breite — Control-Zeilen nutzen den linken Rand */
    gap: 10px;
  }
  .tb-title { font-size: 16px; }
  .tb-btn span,
  .tb-autoplay-toggle span { display: none; } /* Action-Buttons icon-only */

  /* Zeile 1: Titel wächst (nur er weicht dem fixed Hamburger aus), Aktions-Icons rechts. */
  .tb-left { order: 0; flex: 1 1 auto; min-width: 0; margin-left: 46px; }
  .tb-actions { order: 1; flex: 0 0 auto; gap: 8px; }
  .tb-actions .tb-btn { height: 38px; }

  /* Controls in volle Breite, je eigene Zeile. */
  .tb-right {
    order: 2;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .tb-range {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  /* Presets füllen die Breite gleichmäßig (umbrechend). */
  .tb-pills { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .tb-pill { flex: 1 1 auto; justify-content: center; min-width: 0; height: 38px; font-size: 13.5px; }
  /* Datumsfelder 2-spaltig, Anwenden volle Breite darunter. */
  .tb-custom { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .tb-dash { display: none; }
  .tb-date { flex: 1 1 0; min-width: 0; height: 40px; font-size: 14px; }
  .tb-apply { flex: 1 1 100%; height: 40px; justify-content: center; }
  /* Autoplay: Play-Toggle + 2 Dropdowns füllen die Breite. */
  .tb-autoplay { width: 100%; display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
  .tb-autoplay-toggle { flex: 0 0 auto; height: 40px; }
  .tb-autoplay .tb-select { flex: 1 1 0; min-width: 0; height: 40px; font-size: 13.5px; }
}

/* ── Sync-Info + Icon-Button (PB1 Parity) ── */
.tb-sync { font-size: 12px; color: var(--t-muted); white-space: nowrap; }
.tb-icon-btn { padding: 8px; }
@media (max-width: 860px) { .tb-sync { display: none; } }
