/* ================= TOP APP BAR & ULTRA-MINIMALIST MATERIAL TABS ================= */
header.md-top-app-bar {
  height: 54px;
  background: var(--md-surface);
  border-bottom: 1px solid var(--md-outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  padding: 4px 8px 4px 4px;
  border-radius: 10px;
  transition: background-color 0.18s var(--md-ease);
}
.brand-cluster:hover {
  background: var(--md-primary-tint-weak);
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px var(--brand-glow));
  transition: transform 0.22s var(--md-ease);
}
.brand-cluster:hover .brand-mark {
  transform: scale(1.05);
}
.brand-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--md-on-surface);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-wordmark-rapid {
  background: var(--brand-wordmark-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--md-primary);
  background: var(--md-primary-container);
  padding: 2px 7px;
  border-radius: var(--md-radius-pill);
  letter-spacing: 0;
}

/* Top Status Chips */
.status-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}
.md-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--md-radius-pill);
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  color: var(--md-on-surface-variant);
  font-weight: 500;
}
.md-chip strong { color: var(--md-on-surface); font-weight: 600; }
.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--md-secondary);
  box-shadow: 0 0 8px var(--md-secondary);
}
.dot-rec {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--md-danger-strong);
  animation: pulseRec 1.1s infinite ease-in-out;
}
@keyframes pulseRec {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

/* Segmented Light / System / Dark Theme Switch */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  margin-left: 4px;
  border-radius: var(--md-radius-pill);
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
}
.theme-switch-btn {
  width: 28px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: none;
  border-radius: var(--md-radius-pill);
  background: transparent;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  transition: background-color 0.18s var(--md-ease), color 0.18s var(--md-ease), box-shadow 0.18s var(--md-ease);
}
.theme-switch-btn:hover { color: var(--md-on-surface); background: var(--md-hover-overlay); }
.theme-switch-btn:focus-visible { outline: 2px solid var(--md-primary); outline-offset: 1px; }
.theme-switch-btn[aria-checked="true"] {
  background: var(--md-surface);
  color: var(--md-primary);
  box-shadow: var(--md-elevation-1);
}

/* Theme-aware inline brand mark (top app bar) */
.brand-mark .bm-plate { fill: var(--brand-plate); stroke: var(--brand-plate-stroke); }
.brand-mark .bm-arm-0 { stop-color: var(--brand-arm-0); }
.brand-mark .bm-arm-1 { stop-color: var(--brand-arm-1); }
.brand-mark .bm-arm-2 { stop-color: var(--brand-arm-2); }
.brand-mark .bm-vec-0 { stop-color: var(--brand-vec-0); }
.brand-mark .bm-vec-1 { stop-color: var(--brand-vec-1); }
.brand-mark .bm-vec-2 { stop-color: var(--brand-vec-2); }
.brand-mark .bm-core-ring { fill: var(--brand-plate); stroke: var(--brand-core-ring); }
.brand-mark .bm-core-iris { fill: var(--brand-core-iris); }

/* Brand kit images that exist in a dark and a light variant */
.theme-img-light { display: none; }
:root[data-theme="light"] .theme-img-dark { display: none; }
:root[data-theme="light"] .theme-img-light { display: block; }
