/* header — top bar: logo, nav, actions. Wraps to two rows on phones. */
.header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--c-dark);
  background: var(--c-bg);
  box-shadow: inset 0 -1px 0 var(--c-light), 0 1px 0 var(--c-shade);
}

.header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-5);
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-3) var(--gutter);
  padding-top: max(var(--sp-3), env(safe-area-inset-top));
}

.header__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-width: 0;
  color: var(--c-text);
  text-decoration: none;
}

.header__brand:hover {
  text-decoration: none;
}

.header__logo {
  width: 32px;
  height: 32px;
  flex: none;
  filter: sepia(0.64) grayscale(0.32);
}

.header__name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.header__title {
  font-size: var(--fs-l);
  font-weight: 700;
  white-space: nowrap;
}

.header__subtitle {
  color: var(--c-text-faint);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header__nav {
  display: flex;
  order: 3;
  flex: 1 0 100%;
  gap: var(--sp-1);
  overflow-x: auto;
  scrollbar-width: none;
}

.header__nav::-webkit-scrollbar {
  display: none;
}

.header__link {
  flex: none;
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid transparent;
  color: var(--c-text-dim);
  white-space: nowrap;
}

.header__link:hover {
  border-color: var(--bevel-raised);
  color: var(--c-text);
  text-decoration: none;
}

.header__link--active {
  border-color: var(--bevel-sunken);
  background: var(--c-bg-sunken);
  color: var(--c-accent);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.header__user {
  max-width: 120px;
  overflow: hidden;
  color: var(--c-text-dim);
  font-size: var(--fs-s);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 760px) {
  .header__nav {
    order: 0;
    flex: 1 1 auto;
    margin-left: var(--sp-5);
  }

  .header__actions {
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .header__subtitle,
  .header__user,
  .header__actions .button__label {
    display: none;
  }

  .header__actions .button {
    min-width: var(--control-h);
    padding-inline: var(--sp-3);
  }
}
