/*
 * Conversation actions respond to the panel width, not only to the viewport.
 * The chat panel is often narrow while the desktop viewport is still wide.
 */
#chats .messages {
  container-name: conversation-panel;
  container-type: inline-size;
}

@container conversation-panel (max-width: 720px) {
  #chats .messages > header {
    min-height: 106px;
    height: auto !important;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'contact contact'
      'assignment intervene';
    align-content: center;
    align-items: stretch;
    gap: 9px 10px;
    padding: 11px 14px;
    overflow: visible;
  }

  #chats .messages > header .chat-contact {
    grid-area: contact;
    width: 100%;
    min-width: 0;
  }

  #chats .messages > header .chat-number-line {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  #chats .messages > header .chat-contact > small {
    width: 100%;
    max-width: 100% !important;
  }

  #chats .messages > header .chat-assignment {
    grid-area: assignment;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-left: 0;
  }

  #chats .messages > header .chat-assignment select {
    width: 100% !important;
    min-width: 0;
  }

  #chats .messages > header #intervene {
    grid-area: intervene;
    min-height: 32px;
    white-space: nowrap;
  }
}

@container conversation-panel (max-width: 420px) {
  #chats .messages > header {
    min-height: 148px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'contact'
      'assignment'
      'intervene';
  }

  #chats .messages > header #intervene {
    width: 100%;
  }
}
