@layer components {
  .topbar {
    position: fixed;
    z-index: 1000;
    top: 20px;
    left: 24px;
    right: 24px;
    height: 42px;
    display: flex;
    align-items: center;
    pointer-events: none;
  }

  .brand-menu,
  .profile-menu {
    position: relative;
    pointer-events: auto;
  }

  .brand {
    height: 42px;
    padding: 5px 9px 5px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(253, 252, 248, .97);
    border: 1px solid rgba(222, 217, 207, .8);
    border-radius: 14px;
    box-shadow: 0 7px 22px rgba(33, 35, 30, .13);
    list-style: none;
    cursor: pointer;
    backdrop-filter: blur(10px);
  }

  .brand::-webkit-details-marker,
  .profile-menu summary::-webkit-details-marker {
    display: none;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #fff;
    background: #2d302b;
    border-radius: 10px;
    font-weight: 650;
  }

  .brand-copy strong,
  .brand-copy small {
    display: block;
    line-height: normal;
    white-space: nowrap;
  }

  .brand-copy strong {
    font-size: 14px;
    font-weight: 600;
  }

  .brand-copy small {
    color: var(--muted);
    font-size: 10px;
  }

  .brand-chevron {
    width: 11px;
    color: var(--muted);
    transform: rotate(90deg);
    transition: transform .18s;
  }

  .brand-menu[open] .brand-chevron {
    transform: rotate(-90deg);
  }

  .brand-dropdown {
    position: absolute;
    top: 49px;
    left: 0;
    width: 220px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
  }

  .brand-dropdown p {
    margin: 6px 8px 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
  }

  .brand-dropdown hr {
    margin: 6px 0;
    border: 0;
    border-top: 1px solid var(--line);
  }

  .brand-dropdown > a {
    height: 32px;
    padding: 0 9px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    font-size: 12px;
  }

  .brand-dropdown > a:hover,
  .brand-dropdown > a.active {
    background: var(--surface-soft);
  }

  .top-nav-link {
    height: 38px;
    padding: 0 15px;
    display: grid;
    place-items: center;
    color: var(--muted);
    border-radius: 12px;
    font-size: 12px;
  }

  .top-nav-link:hover {
    color: var(--ink);
    background: var(--surface-soft);
  }

  .top-nav-link.active {
    color: var(--ink);
    background: #f1ede4;
    font-weight: 600;
  }

  .topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .profile-menu summary {
    height: 42px;
    padding: 0 12px 0 6px;
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(253, 252, 248, .97);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 7px 22px rgba(33, 35, 30, .13);
    list-style: none;
    cursor: pointer;
  }

  .profile-menu summary span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--green);
    border-radius: 50%;
    font-size: 11px;
  }

  .profile-menu summary strong {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }

  .profile-dropdown {
    position: absolute;
    top: 44px;
    right: 0;
    width: 190px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
  }

  .profile-heading {
    padding: 8px 9px 11px;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--line);
  }

  .profile-heading strong,
  .profile-heading small {
    display: block;
  }

  .profile-heading strong {
    font-size: 14px;
  }

  .profile-heading small {
    color: var(--muted);
    font-size: 10px;
  }

  .profile-dropdown > a {
    padding: 9px;
    display: block;
    border-radius: 8px;
    font-size: 12px;
  }

  .profile-dropdown > a:hover {
    background: var(--surface-soft);
  }

  .profile-signout {
    width: 100%;
    padding: 9px;
    color: #8f3f37;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--line);
    text-align: left;
    font-size: 10px;
  }

  .profile-menu * {
    line-height: normal;
  }

  @media (max-width: 980px) {
    .topbar {
      left: 18px;
      right: 18px;
    }

    .brand-copy small {
      display: none;
    }

    .top-nav-link {
      padding: 0 11px;
    }
  }

  @media (max-width: 680px) {
    .topbar {
      top: 9px;
      left: 9px;
      right: 9px;
      height: 42px;
    }

    .brand-mark {
      width: 32px;
      height: 32px;
    }

    .brand-copy {
      display: none;
    }

    .brand {
      width: 43px;
      padding: 5px;
    }

    .brand-chevron {
      display: none;
    }

    .profile-menu summary {
      width: 42px;
      padding: 0 6px;
    }

    .profile-menu summary strong {
      display: none;
    }

    .brand-dropdown {
      top: 48px;
    }
  }
}
