.topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(var(--space-5), env(safe-area-inset-right)) 0 max(var(--space-3), env(safe-area-inset-left));
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.menu-toggle {
  flex-shrink: 0;
}

.topbar-title {
  display: flex;
  min-width: 0;
}

.topbar-title .active-file-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.path-dir {
  color: var(--text-muted);
  font-weight: 500;
}

.path-base {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.theme-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  color: var(--accent-yellow);
}

.theme-toggle:hover {
  background-color: var(--bg-hover);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  position: absolute;
  top: 50%;
  left: 50%;
  transition: opacity 0.35s var(--theme-easing), transform 0.35s var(--theme-easing);
}

.theme-toggle .icon-sun {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4) rotate(-90deg);
}

.theme-toggle .icon-moon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
  color: var(--accent-blue);
}

html.theme-light .theme-toggle .icon-sun {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
}

html.theme-light .theme-toggle .icon-moon {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4) rotate(90deg);
}

@media (max-width: 720px) {
  .topbar {
    height: 48px;
  }
}
