
#app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-height: var(--header-height);
  padding: 4px 8px 4px 12px;
  padding-top: calc(4px + env(safe-area-inset-top, 0));
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.header-brand:hover .header-profile-frame,
.header-brand:focus-visible .header-profile-frame {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(77, 163, 255, 0.25);
}

.header-profile-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border: 2px solid var(--border);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: block;
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
  line-height: 1;
}

.header-actions {
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--text-dim);
}

.header-settings-btn:hover,
.header-settings-btn:focus-visible,
.header-settings-btn[aria-expanded="true"] {
  background: var(--bg);
  color: var(--text);
}

.header-settings-icon,
.sleep-prep-gear-icon {
  display: block;
  flex-shrink: 0;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 188px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 30;
}

.settings-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.settings-menu-item:hover,
.settings-menu-item:focus-visible {
  background: var(--bg);
}

.settings-menu-item-danger {
  color: var(--red);
}

.status-banner {
  flex: 1;
  min-width: 0;
  padding: 0 4px;
  font-size: 13px;
  text-align: center;
  border: none;
  background: transparent;
  font-family: inherit;
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-banner.agents-active {
  cursor: pointer;
}

.status-banner.agents-active:hover,
.status-banner.agents-active:focus-visible {
  background: rgba(245, 197, 66, 0.08);
}

.status-banner.healthy { color: var(--green); }
.status-banner.stale,
.status-banner.degraded { color: var(--yellow); }
.status-banner.disconnected { color: var(--red); }
.status-banner.agents-active { color: var(--yellow); }

.logs-status-banner {
  display: block;
  width: 100%;
  padding: 8px 0 0;
  text-align: left;
  cursor: default;
}

.logs-status-banner.agents-active {
  cursor: pointer;
}

.logs-status-banner.agents-active:hover,
.logs-status-banner.agents-active:focus-visible {
  color: var(--accent);
}

#logs-status-card .section-header {
  align-items: center;
}

#logs-status-card .battery-status {
  margin-left: auto;
}

.battery-status {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  white-space: nowrap;
}

.battery-status.on-ac {
  color: var(--green);
  border-color: rgba(61, 214, 140, 0.35);
}

.battery-status.on-battery {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.08);
}

.battery-status.low {
  animation: power-alert-pulse 2s ease-in-out infinite;
}

.power-alert {
  position: sticky;
  top: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 107, 107, 0.14);
  border-bottom: 1px solid rgba(255, 107, 107, 0.45);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.power-alert.low {
  animation: power-alert-pulse 2s ease-in-out infinite;
}

@keyframes power-alert-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.power-alert-text {
  max-width: 720px;
}

.viewer-banner {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: rgba(77, 163, 255, 0.12);
  border-bottom: 1px solid rgba(77, 163, 255, 0.35);
  color: #9ecfff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.viewer-banner-text,
#viewer-banner-text {
  max-width: 720px;
}

body.viewer-mode .tab-btn.hidden {
  display: none;
}

.presence-strip {
  position: sticky;
  top: 0;
  z-index: 7;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(26, 35, 50, 0.92);
  backdrop-filter: blur(6px);
  font-size: 12px;
}

.presence-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 4px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.presence-chip img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.presence-chip.self {
  opacity: 0.7;
  font-weight: 400;
}

.presence-overlay-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 6;
}

.presence-viewport-outline {
  position: absolute;
  left: 6px;
  right: 6px;
  border: 1.5px solid rgba(158, 207, 255, 0.55);
  border-radius: 14px;
  box-shadow:
    0 0 22px rgba(158, 207, 255, 0.26),
    inset 0 0 16px rgba(158, 207, 255, 0.1);
  transition: top 0.9s ease, height 0.9s ease;
  animation: presence-hover 3.4s ease-in-out infinite;
}

@keyframes presence-hover {
  0%, 100% {
    transform: translateY(0);
    box-shadow:
      0 0 18px rgba(158, 207, 255, 0.2),
      inset 0 0 12px rgba(158, 207, 255, 0.08);
  }
  50% {
    transform: translateY(-3px);
    box-shadow:
      0 0 28px rgba(158, 207, 255, 0.34),
      inset 0 0 18px rgba(158, 207, 255, 0.15);
  }
}

.presence-viewport-badge {
  position: absolute;
  top: 8px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  background: rgba(15, 20, 25, 0.85);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.presence-viewport-badge img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

