/* V8 communications audit owner: compact desktop surfaces and single-border controls. */
.bms-opendesign-v8 .internal-chat-window {
  width: min(800px, calc(100vw - 36px));
  height: min(600px, calc(100dvh - 110px));
}

.bms-opendesign-v8 .pop-nexus-window {
  width: min(440px, calc(100vw - 36px));
  height: min(640px, calc(100dvh - 110px));
}

/* Wave 5 correctly styles standalone fields. Inputs nested inside a framed
   composite control must remain borderless or the result is a double frame. */
.bms-opendesign-v8 :is(
  .chat-sidebar-toolbar label,
  .chat-online-panel > label,
  .chat-composer,
  .pop-nexus-composer
) :is(input, textarea) {
  border: 0 !important;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
  outline: 0 !important;
}

.bms-opendesign-v8 :is(.chat-composer, .pop-nexus-composer) {
  border: 1px solid var(--line);
  background: var(--surface);
}

/* Textarea controls receive generic field padding from the foundation layer.
   Keep entered multiline text compact, but center the empty-state placeholder
   mathematically by matching its line box to the 44px composer controls. */
.bms-opendesign-v8 .pop-nexus-composer textarea {
  min-height: 34px;
  padding: 7px 3px !important;
  line-height: 20px !important;
  font-family: var(--bms-font-ui);
}

.bms-opendesign-v8 .pop-nexus-composer textarea:placeholder-shown {
  height: 44px !important;
  min-height: 44px;
  padding-block: 0 !important;
  line-height: 44px !important;
  overflow-y: hidden;
}

.bms-opendesign-v8 :is(.chat-composer, .pop-nexus-composer):focus-within,
.bms-opendesign-v8 .chat-sidebar-toolbar label:focus-within,
.bms-opendesign-v8 .chat-online-panel > label:focus-within {
  border-color: var(--bms-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bms-primary) 12%, transparent);
}

/* The message article is layout-only. The inner bubble owns the one visible
   border; keeping both produced the nested cards found during the audit. */
.bms-opendesign-v8 .pop-nexus-message,
.bms-opendesign-v8 .pop-nexus-message.user {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.bms-opendesign-v8 .pop-nexus-message.user > div {
  border-color: color-mix(in srgb, var(--bms-primary) 45%, transparent);
  color: var(--bms-surface);
  background: var(--bms-primary);
}

.bms-opendesign-v8 :is(.pop-nexus-avatar, .pop-nexus-message-avatar) svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bms-opendesign-v8 .pop-nexus-messages {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 50%, transparent) transparent;
}

.bms-opendesign-v8 .pop-nexus-tools-sheet {
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.bms-opendesign-v8 :is(.internal-chat-header, .pop-nexus-header) button {
  flex: 0 0 auto;
  min-width: 36px;
  min-height: 36px;
}

@media (max-width: 900px), (orientation: landscape) and (max-width: 950px) and (max-height: 500px) {
  .bms-opendesign-v8 .topbar {
    flex-wrap: nowrap;
    gap: var(--bms-space-2);
  }

  .bms-opendesign-v8 .topbar-brand {
    flex: 1 1 auto;
    overflow: hidden;
    max-width: none;
  }

  .bms-opendesign-v8 .shell-breadcrumbs {
    overflow: hidden;
  }

  .bms-opendesign-v8 .topbar-user-actions {
    flex: 0 0 auto;
    gap: var(--bms-space-2);
  }

  .bms-opendesign-v8 .floating-actions-container {
    position: static;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: auto;
    width: auto;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: var(--bms-space-2);
    padding: 0;
    transform: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .bms-opendesign-v8 .floating-action-host {
    flex: 0 0 var(--bms-control-touch);
  }

  .bms-opendesign-v8 #floatingActionsContainer button.floating-action-bubble {
    width: var(--bms-control-touch);
    min-width: var(--bms-control-touch);
    height: var(--bms-control-touch);
    min-height: var(--bms-control-touch);
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--bms-primary) 30%, var(--bms-border));
    border-radius: var(--bms-radius-round);
    color: var(--bms-surface);
    background: var(--bms-primary);
    box-shadow: none;
    transform: none;
  }

  .bms-opendesign-v8 #floatingActionsContainer button.floating-action-bubble:hover {
    background: var(--bms-primary-hover);
    box-shadow: none;
    transform: none;
  }

  .bms-opendesign-v8 #floatingActionsContainer button.floating-action-bubble:active {
    background: var(--bms-primary-active);
  }

  .bms-opendesign-v8 #floatingActionsContainer button.floating-action-bubble:focus-visible {
    outline: 2px solid var(--bms-focus);
    outline-offset: 2px;
  }

  .bms-opendesign-v8 #floatingActionsContainer .floating-action-bubble__icon {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
  }

  :root[data-floating-surface] .bms-opendesign-v8 .floating-action-bubble {
    display: none;
  }

  .bms-opendesign-v8 :is(.internal-chat-window, .pop-nexus-window) {
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
  }

  .bms-opendesign-v8 .pop-nexus-messages {
    padding-inline: 12px;
  }

  .bms-opendesign-v8 .pop-nexus-message > div {
    max-width: 88%;
  }

  .bms-opendesign-v8 :is(
    .internal-chat-header button,
    .chat-sidebar-toolbar > button,
    .chat-thread-header > button,
    .chat-info > header button,
    .pop-nexus-icon-btn,
    .pop-nexus-send
  ) {
    width: var(--bms-control-touch);
    min-width: var(--bms-control-touch);
    height: var(--bms-control-touch);
    min-height: var(--bms-control-touch);
  }
}
