@layer components {
  /* Who and what the message is about, set like a list row: name over muted detail. */
  .message-drawer-subject {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 16px;
  }

  .message-drawer-subject-name {
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
  }

  .message-drawer-subject-detail {
    color: var(--color-muted);
    font-size: var(--text-sm);
  }

  /* Switchable message tones — neutral chrome, so the brand colour stays reserved for the
     appointment domain. The selected chip carries a solid neutral fill. One row that scrolls
     sideways, bleeding to the drawer's edges so the cut-off chip shows there's more. */
  .message-drawer-variants {
    display: flex;
    gap: 6px;
    margin: 0 calc(-1 * var(--content-padding)) 12px;
    padding: 0 var(--content-padding);
    overflow-x: auto;
    scrollbar-width: none;
    scroll-padding-inline: var(--content-padding);

    &::-webkit-scrollbar {
      display: none;
    }

    /* A modal on desktop, where a mouse doesn't scroll sideways: the chips wrap. */
    @media (min-width: 1024px) {
      flex-wrap: wrap;
      margin-inline: 0;
      padding-inline: 0;
    }
  }

  .message-drawer-variant {
    flex-shrink: 0;
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-bg-light);
    color: var(--color-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;

    &.active {
      background: var(--color-text);
      border-color: var(--color-text);
      color: var(--color-bg-white);
    }
  }

  .message-drawer-text {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: var(--text-base);
    font-family: inherit;
    line-height: var(--line-height-lg);
    resize: vertical;
    margin-bottom: 16px;
    color: var(--color-text);
    background: var(--color-bg-white);

    &:focus {
      outline: none;
      border-color: var(--color-primary);
    }
  }

  /* The message as it will go out, line breaks kept: four lines, the rest scrolls. */
  .message-drawer-preview {
    max-height: calc(4lh + 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    color: var(--color-text);
    font-size: var(--text-base);
    line-height: var(--line-height-lg);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .message-drawer-setup {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--color-muted);
    font-size: var(--text-sm);
  }

  .ready-messages-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
  }

  .message-drawer-send {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;

    svg {
      width: 20px;
      height: 20px;
    }
  }

  /* The quiet way out: WhatsApp with nothing written. */
  .message-drawer-blank {
    display: block;
    margin-top: 14px;
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-muted);
    text-decoration: none;
  }

  /* A charge still in Cobrados: when it went out, and when the next one can. */
  .message-drawer-sent {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 24px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    color: var(--color-text);
    font-size: var(--text-sm);
  }

  .message-drawer-sent-next {
    color: var(--color-muted);
  }
}
