:root {
  --chat-viewport-height: 100dvh;
  --chat-viewport-top: 0px;
  --chat-nav-height: calc(74px + env(safe-area-inset-bottom));
}

.tab-bar {
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
}

.pipeline-status-trigger {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.pipeline-status-trigger:focus-visible {
  outline: 2px solid #0b57d0;
  outline-offset: 2px;
}

.messages-pipeline-sheet .messages-pipeline-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}

.messages-pipeline-sheet .messages-pipeline-select {
  margin: 0;
}

.messages-pipeline-sheet .messages-pipeline-control > button {
  width: 100%;
}

.messages-chat-controls {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.trial-no-client-badge,
.trial-detail-no-client {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid #d8dee7;
  border-radius: 999px;
  background: #f3f5f8;
  color: #68738a;
  font-size: 11px;
  font-weight: 700;
}

.trial-no-client-badge {
  margin-top: 6px;
  padding: 3px 7px;
}

.trial-detail-no-client {
  margin: 0 0 10px;
  padding: 4px 8px;
}

body.messages-chat-open {
  height: var(--chat-viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body.messages-chat-open .shell {
  position: fixed;
  top: var(--chat-viewport-top, 0px);
  left: 50%;
  width: min(100%, 760px);
  height: var(--chat-viewport-height, 100dvh);
  min-height: 0;
  margin: 0;
  transform: translateX(-50%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: max(10px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    var(--chat-nav-height)
    max(12px, env(safe-area-inset-left));
}

body.messages-chat-open .app-header {
  gap: 10px;
  margin-bottom: 8px;
}

body.messages-chat-open .brand {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 20px;
}

body.messages-chat-open .app-header h1 {
  margin-bottom: 0;
  font-size: 20px;
}

body.messages-chat-open .app-header .subtitle {
  display: none;
}

body.messages-chat-open #messages-view,
body.messages-chat-open .messages-card,
body.messages-chat-open #messages-chat {
  min-height: 0;
  overflow: hidden;
}

body.messages-chat-open #messages-view,
body.messages-chat-open .messages-card {
  height: 100%;
}

body.messages-chat-open .messages-card {
  display: grid;
  padding: 12px;
}

body.messages-chat-open #messages-chat {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 6px;
  height: 100%;
}

body.messages-chat-open .messages-chat-header {
  margin-bottom: 0;
}

body.messages-chat-open .messages-schedule-trial {
  min-height: 40px;
  margin: 0;
  padding-block: 8px;
}

body.messages-chat-open .messages-chat-controls > .messages-status:empty {
  display: none;
}

body.messages-chat-open .messages-chat-controls > .messages-status {
  min-height: 0;
  margin: 0;
}

body.messages-chat-open .messages-channel-chips {
  padding: 0;
}

body.messages-chat-open .messages-channel-actions {
  margin-bottom: 0;
}

body.messages-chat-open .messages-feed {
  min-height: 0;
  height: auto;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body.messages-chat-open .messages-composer {
  margin-top: 0;
  padding-bottom: 2px;
}

body.messages-chat-open .tab-bar {
  top: calc(var(--chat-viewport-top, 0px) + var(--chat-viewport-height, 100dvh) - var(--chat-nav-height));
  bottom: auto;
  width: min(100%, 760px);
  min-height: var(--chat-nav-height);
}

.message-bubble {
  max-width: min(88%, 540px);
}

@media (max-width: 390px) {
  body.messages-chat-open .messages-compose-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  body.messages-chat-open .messages-compose-row button[type="submit"] {
    grid-column: auto;
    padding-inline: 9px;
  }

  body.messages-chat-open .messages-attach-image {
    min-width: 50px;
    padding-inline: 8px;
  }
}
