.office-hub {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 18rem;
  min-height: 2.625rem;
  padding: 0.3rem 0.9rem 0.3rem 0.3rem;
  border: 1px solid var(--app-surface-muted);
  border-radius: var(--app-radius-xl);
  background: var(--app-surface-muted);
  color: var(--app-fg);
  text-align: left;
  overflow: visible;
  appearance: none;
  font: inherit;

  .logo,
  .initials {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--app-fg);
    color: var(--app-fg-on-inverse);
  }

  .initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--app-text-xs);
    letter-spacing: 0.02em;
  }

  .copy {
    min-width: 0;
  }

  .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--app-text-sm);
    font-weight: 600;
    line-height: 1.2;
  }

  .subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--app-text-xs);
    color: var(--app-fg-muted);
    line-height: 1.2;
  }

  .count {
    position: absolute;
    top: -0.2rem;
    right: -0.2rem;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.25rem;
    border-radius: var(--app-form-select-radius);
    background: var(--app-accent-yellow);
    color: var(--app-fg);
    font-size: var(--app-text-xs);
    font-weight: 600;
    line-height: 1.15rem;
    text-align: center;
  }

  .confirm {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 1041;
    max-width: 18rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--app-radius-sm);
    background: var(--app-chrome);
    color: var(--app-fg-on-inverse);
    font-size: var(--app-text-xs);
    font-weight: 600;
    box-shadow: var(--app-shadow-lg);
    white-space: normal;
  }

  &.pending {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-accent-yellow) 70%, transparent);
  }

  &.received {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-accent-yellow) 85%, transparent);
  }

  &.interactive {
    cursor: pointer;

    &[aria-expanded='true'] {
      border-color: var(--app-chrome);
      background: var(--app-chrome);
      color: var(--app-fg-on-inverse);

      .initials {
        background: var(--app-surface);
        color: var(--app-fg);
      }

      .subtitle {
        color: color-mix(in srgb, var(--app-fg-on-inverse) 75%, transparent);
      }
    }

    @media (hover: hover) and (pointer: fine) {
      &:not([aria-expanded='true']):hover {
        background: var(--app-bg-wash);
      }
    }
  }

  &.compact {
    max-width: 11rem;
    height: 42px;
    padding: 0.2rem 0.7rem 0.2rem 0.2rem;
  }
}

.office-hub-flight {
  position: fixed;
  z-index: 2000;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  border-radius: 50%;
  background: var(--app-accent-yellow);
  pointer-events: none;
}

.simplified-header-mobile {
  .office-hub.compact {
    @media (max-width: 991.98px) {
      height: 38px;
    }
  }
}

.client-questions {
  .sheet {
    position: fixed;
    z-index: 1040;
    top: calc(var(--app-header-height) + var(--app-admin-bar-height, 0px) + 0.5rem);
    right: max(1.25rem, env(safe-area-inset-right, 0px));
    width: min(24rem, calc(100vw - 2rem));
    max-height: min(36rem, calc(100dvh - var(--app-header-height) - var(--app-admin-bar-height, 0px) - 1.5rem));
    display: flex;
    flex-direction: column;
    background: var(--app-surface);
    border-radius: var(--app-radius-modal);
    box-shadow: var(--app-shadow-lg);
    overflow: hidden;

    &[hidden] {
      display: none !important;
    }

    @media (max-width: 575.98px) {
      right: 0.75rem;
      left: 0.75rem;
      width: auto;
    }
  }

  .heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    background: var(--app-bg-muted);

    .identity {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      min-width: 0;

      .logo,
      .initials {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
        background: var(--app-fg);
        color: var(--app-fg-on-inverse);
      }

      .initials {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
      }

      .copy {
        min-width: 0;

        h2 {
          margin: 0;
          font-size: var(--app-text-base);
          font-weight: 600;
        }

        .timing {
          margin: 0.15rem 0 0;
          color: var(--app-fg-muted);
          font-size: var(--app-text-sm);
        }
      }
    }

    .close {
      border: 0;
      background: transparent;
      color: var(--app-fg-muted);
      padding: 0.25rem;
      line-height: 1;
    }
  }

  .body {
    padding: 1rem;
    overflow: auto;

    .greeting {
      color: var(--app-fg-muted);
    }

    .history {
      margin-top: 1.5rem;
      padding-top: 1rem;
      border-top: 1px solid var(--app-separator);

      h3 {
        font-size: var(--app-text-sm);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--app-fg-subtle);
        margin-bottom: 0.75rem;
      }

      .item {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--app-separator);

        &:last-child {
          border-bottom: 0;
          padding-bottom: 0;
        }

        .meta {
          display: flex;
          flex-wrap: wrap;
          gap: 0.5rem;
          font-size: var(--app-text-xs);
          color: var(--app-fg-subtle);
          margin-bottom: 0.35rem;
        }

        .state {
          font-weight: 600;
          color: var(--app-fg-muted);
        }

        &.open .state {
          color: var(--app-ok-fg);
        }
      }
    }
  }
}

.ask-about-view {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.375rem;
  padding: 0.2rem 0.75rem 0.2rem 0.2rem;
  border: 1px solid var(--app-border-subtle, var(--app-surface-muted));
  border-radius: var(--app-radius-xl);
  background: var(--app-surface);
  color: var(--app-fg);
  font: inherit;
  appearance: none;

  .logo,
  .initials {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--app-fg);
    color: var(--app-fg-on-inverse);
  }

  .initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--app-text-xs);
  }

  .label {
    font-size: var(--app-text-sm);
    font-weight: 600;
    white-space: nowrap;
  }

  @media (hover: hover) and (pointer: fine) {
    &:hover {
      background: var(--app-bg-wash);
    }
  }
}

.client-questions,
.office-questions {
  .text {
    white-space: pre-wrap;
    margin: 0;
  }

  .answer {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--app-radius-xl);
    background: var(--app-bg-muted);

    .by {
      margin: 0 0 0.35rem;
      font-size: var(--app-text-xs);
      font-weight: 600;
      color: var(--app-fg-muted);
    }
  }
}
