.bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 220px;
  height: 100%;
  padding: var(--theme-space-3) var(--theme-space-2);
  background: var(--theme-surface-raised);
  border-right: 1px solid var(--theme-border-subtle);
  transition: width 180ms ease;
}

.bar.is-collapsed {
  width: 64px;
}

.bar-items {
  display: flex;
  flex-direction: column;
  gap: var(--theme-space-3);
}

.bar-item {
  display: flex;
  align-items: center;
  gap: var(--theme-space-3);
  padding: var(--theme-space-2) var(--theme-space-3);
  border-radius: var(--theme-radius-md);
  color: var(--theme-text-secondary);
  font-size: var(--theme-font-sm);
  font-weight: var(--theme-font-weight-medium);
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}

.bar-item:hover {
  background: var(--theme-bg-tertiary);
  color: var(--theme-text-primary);
}

.bar-item.is-active {
  background: var(--theme-color-primary);
  color: var(--theme-text-inverse);
}

.bar-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.bar-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar.is-collapsed .bar-item {
  justify-content: center;
  padding: var(--theme-space-2);
}

.bar.is-collapsed .bar-item-label {
  display: none;
}

/* Support — quiet acknowledgement of the companies backing the initiative,
   pinned to the bottom of the sidebar. */
.bar-support {
  display: flex;
  flex-direction: column;
  gap: var(--theme-space-2);
  margin-top: auto;
  padding-top: var(--theme-space-4);
}

.bar-support-title {
  padding: 0 var(--theme-space-3);
  color: var(--theme-text-tertiary, var(--theme-text-secondary));
  font-size: 10px;
  font-weight: var(--theme-font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-support-list {
  display: flex;
  flex-direction: column;
  gap: var(--theme-space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.bar-support-item {
  display: flex;
}

.bar-support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--theme-space-2);
  border-radius: var(--theme-radius-md);
  background: white;
  transition: transform 120ms ease;
}

.bar-support-link:hover {
  transform: translateY(-1px);
}

.bar-support-logo {
  display: block;
  width: 100%;
  max-width: 110px;
  height: auto;
  object-fit: contain;
}

.bar.is-collapsed .bar-support-title {
  display: none;
}

.bar.is-collapsed .bar-support-logo {
  max-width: 40px;
}

.bar-toggle {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: var(--theme-space-3);
  border-radius: var(--theme-radius-md);
  color: var(--theme-text-secondary);
  transition: background 120ms ease, color 120ms ease;
}

.bar-toggle:hover {
  background: var(--theme-bg-tertiary);
  color: var(--theme-text-primary);
}

.bar.is-collapsed .bar-toggle {
  align-self: center;
}

@media (max-width: 768px) {
  .bar,
  .bar.is-collapsed {
    flex-direction: row;
    width: 100%;
    height: auto;
    padding: var(--theme-space-2);
    padding-bottom: calc(var(--theme-space-2) + env(safe-area-inset-bottom, 0px));
    border-right: 0;
    border-top: 1px solid var(--theme-border-subtle);
  }

  .bar-items {
    flex: 1;
    flex-direction: row;
    justify-content: space-around;
    gap: var(--theme-space-1);
  }

  .bar-item {
    flex-direction: column;
    gap: var(--theme-space-1);
    padding: var(--theme-space-2);
    font-size: var(--theme-font-xs);
  }

  .bar-item-label,
  .bar.is-collapsed .bar-item-label {
    display: inline;
  }

  .bar-toggle,
  .bar-support {
    display: none;
  }
}
