/**
 * Chatbot Styles
 * Themed with CSS Custom Properties matching transcribe-poc design
 */

/* ============================================================
   APP SHELL — Sidebar (ChatGPT-style)
   ============================================================ */
.app-sidebar {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  min-width: 0;
  position: relative;
  z-index: 2;
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --sidebar-hover-strong: rgba(255, 255, 255, 0.16);
  --sidebar-text: rgba(255, 255, 255, 0.92);
  --sidebar-text-muted: rgba(255, 255, 255, 0.62);
  --sidebar-border: rgba(255, 255, 255, 0.14);
  --sidebar-input-bg: rgba(255, 255, 255, 0.1);
  background-color: var(--sidebar-bg);
  background-image: var(--nav-stripe-image), var(--sidebar-gradient);
  background-repeat: no-repeat;
  background-position: center top, center top;
  background-size: cover;
  border-right: 0.0625rem solid var(--sidebar-border);
  color: var(--sidebar-text);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.app-sidebar::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

@media (min-width: 48.0625em) {
  .app-sidebar:has(.user-section-dropdown.is-open) {
    overflow: visible;
  }
}

.sidebar-label {
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1rem 0.5rem;
  flex-shrink: 0;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
}

.sidebar-logo img {
  height: 2.25rem;
  width: auto;
  display: block;
}

/* Close button only relevant on mobile (off-canvas) */
.sidebar-close {
  display: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--sidebar-text-muted);
  border-radius: 0.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  transition: color 0.2s ease, background 0.2s ease;
}

.sidebar-close:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}

/* Collapse/expand toggle (the "open sidebar" symbol) */
.sidebar-toggle {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--sidebar-text-muted);
  border-radius: 0.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
  transition: color 0.2s ease, background 0.2s ease;
}

.sidebar-toggle:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}

.sidebar-toggle:focus-visible {
  outline: 0.125rem solid var(--primary-500);
  outline-offset: 0.125rem;
}

/* The "Chats" rail button is only meaningful in the collapsed rail */
.app-sidebar .sidebar-action-chats {
  display: none;
}

/* ---- Desktop-only collapsed icon rail (ChatGPT-style) ---- */
@media (min-width: 48.0625em) {
  #main-app.app-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-rail-width) minmax(0, 1fr);
  }

  .sidebar-collapsed .sidebar-top {
    justify-content: center;
    padding: 1rem 0.5rem 0.5rem;
  }

  .sidebar-collapsed .sidebar-logo {
    display: none;
  }

  .sidebar-collapsed .sidebar-actions {
    align-items: center;
    padding: 0.5rem;
  }

  .sidebar-collapsed .sidebar-action-btn {
    justify-content: center;
    align-items: center;
    gap: 0;
    width: 2.75rem;
    min-width: 2.75rem;
    max-width: 2.75rem;
    padding: 0.625rem;
    box-sizing: border-box;
  }

  .sidebar-collapsed .sidebar-action-chats {
    display: flex;
  }

  .sidebar-collapsed .sidebar-label {
    display: none;
  }

  .sidebar-collapsed .sidebar-search,
  .sidebar-collapsed .conversation-list {
    display: none;
  }

  .sidebar-collapsed .sidebar-footer {
    align-items: center;
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 0.5rem 0.5rem 0.875rem;
    overflow: visible;
  }

  .sidebar-collapsed .sidebar-link {
    justify-content: center;
    width: 2.75rem;
    padding: 0.5rem;
  }

  .sidebar-collapsed .sidebar-footer-row {
    justify-content: center;
    width: 100%;
  }
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  flex-shrink: 0;
}

.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: none;
  border-radius: 0.625rem;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-action-btn:hover {
  background: var(--sidebar-hover);
}

.sidebar-action-btn:focus-visible {
  outline: 0.125rem solid rgba(255, 255, 255, 0.45);
  outline-offset: 0.125rem;
}

.sidebar-action-btn .hicon {
  font-size: 1rem;
  color: var(--sidebar-text-muted);
}

.sidebar-new-chat .hicon {
  color: var(--white);
}

a.sidebar-action-btn,
.sidebar-link-btn {
  text-decoration: none;
  color: inherit;
}

.sidebar-action-btn--active {
  background: var(--sidebar-hover-strong);
  color: var(--sidebar-text);
  cursor: default;
}

.sidebar-action-btn--active .hicon {
  color: var(--sidebar-text);
}

.sidebar-search {
  padding: 0.25rem 0 0;
}

.sidebar-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.875rem;
  border: 0.0625rem solid var(--sidebar-border);
  border-radius: 0.625rem;
  background: var(--sidebar-input-bg);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  line-height: 1.375;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sidebar-search-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-search-input::placeholder {
  color: var(--sidebar-text-muted);
}

.sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  position: relative;
  z-index: 20;
  background: transparent;
  padding: 0.5rem 0.75rem 0.875rem;
  border-top: 0.0625rem solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: visible;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.625rem;
  color: var(--sidebar-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.sidebar-link .hicon {
  font-size: 0.9375rem;
  color: var(--sidebar-text-muted);
}

.sidebar-link:hover .hicon {
  color: var(--sidebar-text);
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0.25rem 0;
}

.sidebar-footer #userbar-container {
  width: 100%;
  min-width: 0;
}

/* Mobile backdrop behind off-canvas sidebar */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 32, 33, 0.45);
  backdrop-filter: blur(0.25rem);
  -webkit-backdrop-filter: blur(0.25rem);
  z-index: 1090;
  border: none;
  opacity: 0;
}

.sidebar-backdrop[hidden] {
  display: none;
}

.app-shell.sidebar-open .sidebar-backdrop {
  opacity: 1;
}

/* Conversation list + account row on deep-blue sidebar */
.app-sidebar .conversation-item {
  background: var(--sidebar-hover);
}

.app-sidebar .conversation-item:hover {
  background: var(--sidebar-hover-strong);
}

.app-sidebar .conversation-item.active {
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 0.125rem rgba(255, 255, 255, 0.45);
}

.app-sidebar .conversation-item.active .conversation-item-name {
  color: #fff;
  font-weight: 600;
}

.app-sidebar .conversation-item-name {
  color: var(--sidebar-text);
}

.app-sidebar .conversation-item-date {
  color: var(--sidebar-text-muted);
}

.app-sidebar .conversation-pin-btn,
.app-sidebar .conversation-delete-btn {
  color: var(--sidebar-text-muted);
}

.app-sidebar .conversation-pin-btn:hover,
.app-sidebar .conversation-delete-btn:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover-strong);
}

.app-sidebar .conversation-pin-btn.is-pinned,
.app-sidebar .conversation-item-pin-mark {
  color: var(--primary-blue-200);
}

.app-sidebar .sidebar-footer .user-section-trigger,
.app-sidebar .sidebar-footer .user-section-trigger .hicon,
.app-sidebar .sidebar-footer .user-section-label,
.app-shell:not(.sidebar-collapsed) .app-sidebar .sidebar-footer .user-section-trigger,
.app-shell:not(.sidebar-collapsed) .app-sidebar .sidebar-footer .user-section-trigger .hicon,
.app-shell:not(.sidebar-collapsed) .app-sidebar .sidebar-footer .user-section-label {
  color: var(--sidebar-text-muted);
}

.app-sidebar .sidebar-footer .user-section-trigger:hover,
.app-sidebar .sidebar-footer .user-section-trigger:focus-visible,
.app-shell:not(.sidebar-collapsed) .app-sidebar .sidebar-footer .user-section-trigger:hover,
.app-shell:not(.sidebar-collapsed) .app-sidebar .sidebar-footer .user-section-trigger:focus-visible {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.app-sidebar .sidebar-footer .user-section-trigger:hover .hicon,
.app-sidebar .sidebar-footer .user-section-trigger:hover .user-section-label,
.app-sidebar .sidebar-footer .user-section-trigger:focus-visible .hicon,
.app-sidebar .sidebar-footer .user-section-trigger:focus-visible .user-section-label,
.app-shell:not(.sidebar-collapsed) .app-sidebar .sidebar-footer .user-section-trigger:hover .hicon,
.app-shell:not(.sidebar-collapsed) .app-sidebar .sidebar-footer .user-section-trigger:hover .user-section-label,
.app-shell:not(.sidebar-collapsed) .app-sidebar .sidebar-footer .user-section-trigger:focus-visible .hicon,
.app-shell:not(.sidebar-collapsed) .app-sidebar .sidebar-footer .user-section-trigger:focus-visible .user-section-label {
  color: var(--sidebar-text);
}

.app-sidebar .sidebar-footer .user-section-wrapper:has(.user-section-dropdown.is-open) .user-section-trigger,
.app-sidebar .sidebar-footer .user-section-wrapper:has(.user-section-dropdown.is-open) .user-section-trigger .hicon,
.app-sidebar .sidebar-footer .user-section-wrapper:has(.user-section-dropdown.is-open) .user-section-trigger .user-section-label {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

/* ============================================================
   APP SHELL — Main column + Header
   ============================================================ */
.app-main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  position: relative;
  z-index: 1;
  background: var(--white);
  box-sizing: border-box;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 0.0625rem solid var(--shades-150);
  background: var(--white);
  flex-shrink: 0;
}

.header-menu-btn {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--shades-600);
  border-radius: 0.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.header-menu-btn:hover {
  background: var(--primary-50);
  color: var(--primary-600);
}

.header-menu-btn:focus-visible {
  outline: 0.125rem solid var(--primary-500);
  outline-offset: 0.125rem;
}

.header-brand {
  display: inline-flex;
  align-items: center;
}

.header-logo {
  height: 1.75rem;
  width: auto;
  display: block;
}

.header-titles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--shades-600);
  white-space: nowrap;
}

.header-badge {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--primary-600);
  background: var(--primary-50);
  border: 0.0625rem solid var(--primary-100);
  border-radius: 0.375rem;
  padding: 0.0625rem 0.375rem;
  text-transform: uppercase;
}

/* ============================================================
   Chat area (centered column like ChatGPT)
   ============================================================ */
.chat-container {
  --chat-padding-x: 1.5rem;
  --chat-padding-y: 1rem;
  --chat-content-max: min(94%, 72rem);
  /* Match .input-wrapper row height (vertical padding + send button) */
  --chat-bar-height: calc(0.875rem * 2 + var(--chat-round-btn-size));
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--chat-padding-y) var(--chat-padding-x);
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Center the conversation column; constrain each block */
.chat-messages > * {
  width: 100%;
  max-width: var(--chat-content-max);
}

.message {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(0.625rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user-message {
  flex-direction: row-reverse;
}

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.user-avatar {
  background: var(--shades-600);
  color: var(--white);
}

.bot-avatar {
  background: var(--success-500);
  color: var(--white);
}

.message-content {
  max-width: 88%;
  padding: 1.25rem 1.5rem;
  border: 0.0625rem solid var(--shades-150);
  border-radius: var(--default-border-radius);
  position: relative;
  word-wrap: break-word;
  display: flex;
  flex-direction: column;
  box-shadow: none;
}

.user-message .message-content {
  background: var(--primary-50);
  color: var(--shades-600);
}

.bot-message .message-stack {
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.bot-message .message-content {
  background: var(--white);
  color: var(--shades-600);
  max-width: 100%;
}

.message-text {
  line-height: 1.6;
  font-size: 0.875rem;
}

.bot-message .message-text {
  white-space: pre-line;
}

/* Add spacing between paragraphs for better readability */
.bot-message .message-text p {
  margin-bottom: 0.75rem;
}

/* Ensure proper spacing for numbered lists */
.bot-message .message-text ol,
.bot-message .message-text ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.bot-message .message-text li {
  margin-bottom: 0.25rem;
}

/* Transaction card (compact in chat) */
.bot-message .message-text details.transaction-details {
  margin: 0.75rem 0 0;
  padding: 1rem 1.25rem 1.25rem;
  border: 0.0625rem solid var(--shades-150);
  background: var(--shades-50);
  border-radius: var(--default-border-radius);
  line-height: 1.5;
  color: var(--shades-400);
}

.bot-message .message-text details.transaction-details.transaction-details--related {
  border-color: #efe5a8;
  background: #fffdf0;
}

.bot-message .message-text details.transaction-details:last-child {
  margin-bottom: 0;
}

.bot-message .message-text details.transaction-details > :not(summary) {
  margin-top: 0.75rem;
}

.bot-message .message-text details.transaction-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
  margin: 0;
  padding: 0;
  user-select: none;
}

.bot-message .message-text details.transaction-details summary::-webkit-details-marker {
  display: none;
}

.bot-message .message-text details.transaction-details .transaction-details__summary-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.bot-message .message-text details.transaction-details .transaction-details__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary-50);
}

.bot-message .message-text details.transaction-details.transaction-details--related .transaction-details__icon {
  background: #fff4bf;
}

.bot-message .message-text details.transaction-details .transaction-details__icon .hicon {
  font-size: 0.875rem;
  color: var(--primary-500);
}

.bot-message .message-text details.transaction-details.transaction-details--related .transaction-details__icon .hicon {
  color: #9a7a1f;
}

.bot-message .message-text details.transaction-details .transaction-details__title {
  font-weight: 500;
  color: var(--shades-600);
}

.bot-message .message-text details.transaction-details summary::after {
  content: '';
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-left: 0.5rem;
  background-color: var(--shades-600);
  -webkit-mask: url('../resources/caret-down.svg') no-repeat center;
  mask: url('../resources/caret-down.svg') no-repeat center;
  -webkit-mask-size: contain;
  mask-size: contain;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}

.bot-message .message-text details.transaction-details[open] summary::after {
  transform: rotate(180deg);
}

.message-metadata {
  font-size: 0.6875rem;
  opacity: 0.7;
  color: var(--shades-400);
}

.user-message .message-metadata {
  margin-top: 0.5rem;
  color: var(--shades-400);
}

.bot-message .message-bottom-actions .message-metadata {
  margin: 0;
  padding: 0;
  border: none;
  opacity: 0.6;
  flex: 1;
  min-width: 0;
}

.message-copy-btn-wrapper {
  width: 100%;
}

/* User messages: actions row at bottom, separated by thin line, always visible */
.user-message .message-copy-btn-wrapper {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

/* Bot messages: metadata + copy + redo on one row inside the bubble */
.bot-message .message-bottom-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.bot-message .message-bottom-actions-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.message-edit-btn {
  position: static;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  opacity: 1;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.message-edit-btn:hover {
  color: var(--shades-50);
}

.user-message .message-edit-btn {
  color: var(--primary-500);
}

.user-message .message-edit-btn:hover {
  color: var(--primary-400);
}

/* User messages: bottom-row copy button, always visible */
.user-message .message-copy-btn {
  position: static;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--primary-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  opacity: 1;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.bot-message .message-bottom-actions .message-redo-btn {
  flex-shrink: 0;
}

.bot-message .message-bottom-actions .message-copy-btn {
  width: var(--chat-round-btn-size);
  height: var(--chat-round-btn-size);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--shades-400);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.bot-message .message-bottom-actions .message-copy-btn:hover {
  color: var(--primary-500);
  background: transparent;
}

.bot-message .message-bottom-actions .message-copy-btn .hicon,
.bot-message .message-bottom-actions .message-rate-btn .hicon,
.bot-message .message-bottom-actions .message-redo-btn .hicon,
.input-wrapper .send-button .hicon {
  font-size: 1rem;
}

.message-copy-btn:hover {
  color: var(--primary-400);
}

.user-message .message-copy-btn:hover {
  color: var(--primary-400);
}

/* Rate button — same small icon style as copy */
.bot-message .message-bottom-actions .message-rate-btn {
  width: var(--chat-round-btn-size);
  height: var(--chat-round-btn-size);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--shades-400);
  transition: color 0.2s ease;
}

.bot-message .message-bottom-actions .message-rate-btn:hover {
  color: var(--primary-500);
  background: transparent;
}

.message-rate-btn:disabled,
.message-rate-btn:disabled:hover {
  cursor: default;
  opacity: 0.5;
  background: transparent;
  color: var(--shades-400);
}

.message-rate-btn.message-rate-btn--done {
  cursor: default;
  opacity: 0.55;
  color: var(--shades-400);
  pointer-events: none;
}

.message-actions-footer {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0 0.125rem;
}

.message-actions-footer .message-rate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--chat-round-btn-size);
  min-height: var(--chat-round-btn-size);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  line-height: 1;
  box-sizing: border-box;
  min-width: auto;
  border-radius: 2.5rem;
  text-decoration: none;
}

/* Collapsed: round outline icon; hover expands to pill + label */
.message-support-btn {
  --message-support-btn-expanded-width: 9.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  gap: 0;
  line-height: 1;
  transition:
    width 0.25s ease,
    min-width 0.25s ease,
    max-width 0.25s ease,
    padding 0.25s ease,
    border-radius 0.25s ease,
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.message-support-btn:not(:hover):not(:focus-visible) i {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.message-support-btn i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

.message-support-btn__label {
  display: inline-flex;
  align-items: center;
  flex: 0 0 0;
  width: 0;
  min-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  font-weight: 400;
  line-height: 1;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.message-support-btn:hover,
.message-support-btn:focus-visible {
  width: var(--message-support-btn-expanded-width);
  min-width: var(--message-support-btn-expanded-width);
  max-width: var(--message-support-btn-expanded-width);
  border-radius: 2.5rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  gap: 0.375rem;
}

.message-support-btn:hover i,
.message-support-btn:focus-visible i {
  position: static;
  transform: none;
}

.message-support-btn:hover .message-support-btn__label,
.message-support-btn:focus-visible .message-support-btn__label {
  flex: 0 0 auto;
  width: auto;
  opacity: 1;
}

.message-support-btn.btn-outline.btn-icon.btn-round {
  text-decoration: none;
  line-height: 1;
}

.message-support-btn.btn-outline.btn-icon.btn-round:not(:hover):not(:focus-visible) {
  width: var(--chat-round-btn-size);
  min-width: var(--chat-round-btn-size);
  max-width: var(--chat-round-btn-size);
  height: var(--chat-round-btn-size);
  min-height: var(--chat-round-btn-size);
  padding: 0;
  border-radius: 50%;
}

.message-support-btn.btn-outline.btn-icon.btn-round:hover,
.message-support-btn.btn-outline.btn-icon.btn-round:focus-visible {
  height: var(--chat-round-btn-size);
  min-height: var(--chat-round-btn-size);
  line-height: 1;
}

/* Support escalation confirmation */
.support-confirm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(31, 32, 33, 0.5);
  backdrop-filter: blur(0.25rem);
  z-index: 10000;
}

.support-confirm-modal-overlay.support-confirm-modal-visible {
  display: flex;
}

.support-confirm-modal {
  width: 100%;
  max-width: 26rem;
  background: var(--white);
  border-radius: 0.75rem;
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.support-confirm-modal__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--shades-700);
  line-height: 1.35;
}

.support-confirm-modal__message {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--shades-500);
}

.support-confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.375rem;
}

.support-confirm-modal__actions .btn {
  min-height: 2.25rem;
  padding: 0.5rem 1rem;
}

/* CSAT modal (centered overlay) */
.csat-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(31, 32, 33, 0.5);
  backdrop-filter: blur(0.25rem);
  z-index: 10000;
  overflow: hidden;
}

.csat-modal-overlay.csat-modal-visible {
  display: flex;
}

.csat-modal {
  position: relative;
  max-width: 37.5rem;
  width: 100%;
  overflow: hidden;
}

.csat-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--primary-500);
  opacity: 0.7;
  cursor: pointer;
  padding: 0.25rem;
  z-index: 1;
  border-radius: 0.25rem;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.csat-modal-close:hover {
  opacity: 1;
  color: var(--primary-400);
}

.csat-modal-body {
  padding: 2.5rem 2rem 2rem;
}

.csat-modal .csat-card,
.csat-modal-form.csat-card {
  margin: 0;
  padding: 0;
  max-width: none;
  box-shadow: none;
}

.csat-modal-form {
  margin: 0;
  box-shadow: none;
}

.csat-modal .csat-title-stars {
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.csat-modal .csat-card .csat-title {
  font-size: 1.0625rem;
}

.csat-modal .csat-star {
  font-size: 1.5rem;
}

.csat-submit-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

body.csat-modal-open .chat-messages {
  overflow: hidden;
}

.csat-modal-loading,
.csat-modal-error {
  padding: 1.5rem;
  text-align: center;
  color: var(--shades-600);
}

/* Copy toast (centered, shown after copy) */
.copy-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.copy-toast.visible {
  opacity: 1;
}

/* Uses .message / .message-content like bot replies */
.typing-indicator.message {
  margin-bottom: 1.25rem;
  animation: fadeInUp 0.3s ease-out;
}

.typing-indicator .typing-indicator-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.typing-indicator-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.typing-indicator-text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--shades-400);
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--shades-400);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.input-container {
  padding: 0.5rem var(--chat-padding-x) 0.5rem;
  background: var(--white);
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.input-container > * {
  width: 100%;
  max-width: var(--chat-content-max);
}

/* Nav + input: same width (horizontal inset) and height */
.chat-container > .nav-tabs {
  box-sizing: border-box;
  width: 100%;
  height: var(--chat-bar-height);
  min-height: var(--chat-bar-height);
  padding-left: var(--chat-padding-x);
  padding-right: var(--chat-padding-x);
  align-items: stretch;
}

.chat-container > .nav-tabs .nav-tab,
.chat-container > .nav-tabs .language-button {
  padding-top: 0;
  padding-bottom: 0;
  align-self: stretch;
  align-items: center;
  box-sizing: border-box;
}

.chat-container > .nav-tabs .nav-tab {
  padding-left: 1.5625rem;
  padding-right: 1.5625rem;
}

.chat-container > .nav-tabs .language-button {
  padding-left: 1.5625rem;
  padding-right: 1.5625rem;
  width: auto;
  height: 100%;
  min-height: 100%;
}

.chat-container > .nav-tabs .nav-tabs-selectors {
  align-self: stretch;
  align-items: stretch;
  height: 100%;
}

.chat-container > .nav-tabs .nav-tabs-selectors .localization-dropdown.--dropdown {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  height: 100%;
}

/* Bordered bar (same as .message-content); textarea + send inside */
.chat-container .input-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  box-sizing: border-box;
  min-height: var(--chat-bar-height);
  padding: 0.875rem 1.0625rem 0.875rem 1.5rem;
  border: 0.0625rem solid var(--shades-150);
  border-radius: var(--default-border-radius);
  background: var(--white);
  box-shadow: none;
  transition: border-color 0.35s ease-in-out;
}

.chat-container .input-wrapper:focus-within {
  border-color: var(--shades-150);
}

.chat-container .input-wrapper .message-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.375;
  resize: none;
  max-height: 7.5rem;
  min-height: 1.375rem;
  outline: none;
}

.chat-container .input-wrapper .message-input:focus {
  border: none;
  box-shadow: none;
  background: transparent;
}

.chat-container .input-wrapper .message-input::placeholder {
  color: var(--shades-300);
}

.chat-container .input-wrapper .send-button {
  flex-shrink: 0;
  opacity: 1;
  visibility: visible;
}

.chat-container .input-wrapper .send-button.btn-filled {
  border: none;
  background-color: var(--primary-500);
  background-image: none;
  color: var(--white);
  opacity: 1;
  transition: background-color 0.35s ease-in-out, filter 0.35s ease-in-out;
}

.chat-container .input-wrapper .send-button.btn-filled .hicon,
.chat-container .input-wrapper .send-button.btn-filled .hicon-svg {
  color: var(--white);
}

.chat-container .input-wrapper .send-button.btn-filled:hover:not(:disabled),
.chat-container .input-wrapper .send-button.btn-filled:focus-visible:not(:disabled) {
  background-color: var(--primary-600);
  background-image: none;
  color: var(--white);
  filter: brightness(1.06);
}

.chat-container .input-wrapper .send-button.btn-filled:hover:not(:disabled) .hicon,
.chat-container .input-wrapper .send-button.btn-filled:hover:not(:disabled) .hicon-svg,
.chat-container .input-wrapper .send-button.btn-filled:focus-visible:not(:disabled) .hicon,
.chat-container .input-wrapper .send-button.btn-filled:focus-visible:not(:disabled) .hicon-svg {
  color: var(--white);
}

.chat-container .input-wrapper.chat-input--locked {
  opacity: 0.65;
  pointer-events: none;
}

.chat-container .input-wrapper.chat-input--locked .message-input {
  cursor: not-allowed;
}

.support-escalation-banner {
  margin: 0 0 0.5rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  background: #fee2e2; /* red-100 */
  border: 1px solid #fca5a5; /* red-300 */
  font-size: 0.875rem;
  line-height: 1.4;
  color: #991b1b; /* red-800 */
}

.support-escalation-banner__text {
  margin: 0 0 0.25rem;
}

.support-escalation-banner__link {
  font-weight: 500;
  color: #7f1d1d;
  text-decoration: none;
}

.support-escalation-banner__link:hover {
  text-decoration: underline;
}

.support-escalation-banner--positive-csat {
  background: #dcfce7; /* green-100 */
  border-color: #86efac; /* green-300 */
  color: #166534; /* green-800 */
}

.chat-container .input-wrapper .send-button.btn-filled:disabled {
  background-color: var(--primary-500);
  background-image: none;
  opacity: 0.55;
  color: var(--white);
}

.chat-container .input-wrapper .send-button.btn-filled:disabled .hicon,
.chat-container .input-wrapper .send-button.btn-filled:disabled .hicon-svg {
  color: var(--white);
}

.chat-static-intro {
  margin-bottom: 1rem;
  padding-bottom: 0.25rem;
  border-bottom: 0.0625rem solid var(--shades-150);
}

.welcome-message {
  text-align: center;
  color: var(--shades-400);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.suggestions {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.suggestion-chip {
  padding: 0.5rem 1rem;
  background: var(--shades-150);
  border: none;
  border-radius: 0.625rem;
  font-size: 0.75rem;
  color: var(--shades-600);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
}

.suggestion-chip:hover {
  background: var(--primary-50);
  color: var(--shades-600);
}

.scroll-to-bottom {
  position: fixed;
  bottom: 6.25rem;
  right: 1.875rem;
  width: 3.125rem;
  height: 3.125rem;
  background: var(--shades-600);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.25rem 0.75rem rgba(61, 62, 64, 0.08);
  transition: all 0.2s ease;
}

.scroll-to-bottom:hover {
  transform: translateY(-0.125rem);
  box-shadow: 0 0.375rem 1rem rgba(61, 62, 64, 0.08);
}

.scroll-to-bottom.visible {
  display: flex;
}

/* CSAT Card Styles */
.csat-card {
  padding: 1rem;
  margin: 0.9375rem 0;
  max-width: 37.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.csat-title-stars {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.csat-card .csat-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--shades-600);
  margin: 0;
}

.csat-stars {
  display: flex;
  gap: 0.375rem;
  margin: 0;
}

.csat-star {
  font-size: 1.25rem;
  color: var(--shades-400);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.csat-star:hover,
.csat-star.active {
  color: var(--primary-400);
  transform: scale(1.1);
}

.csat-star.selected {
  color: var(--primary-400);
}

.csat-feedback-container {
  margin-bottom: 0.75rem;
}

.csat-feedback {
  flex: 1;
}

.csat-feedback textarea {
  width: 100%;
  padding: 0.625rem;
  font-size: 0.8125rem;
  resize: vertical;
  min-height: 3.75rem;
}

.csat-modal .csat-feedback textarea {
  box-sizing: border-box;
  min-height: 5rem;
  padding: 0.875rem 1.1875rem;
  font-size: 1.0625rem;
  border: 0.0625rem solid #e5e5e5;
  border-radius: 1rem;
}

.csat-submit {
  min-width: 7.5rem;
  white-space: nowrap;
}

.csat-continue-submit.btn-filled {
  background-color: var(--ink);
  background-image: none;
}

/* Category Selection Card Styles */
.category-selection-card {
  padding: 1.25rem;
  margin: 0.9375rem 0;
  max-width: 37.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-selection-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--shades-600);
  margin: 0;
}

.category-selection-instruction {
  font-size: 0.875rem;
  color: var(--shades-400);
  margin: 0;
}

.category-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: none;
  border-radius: 0.625rem;
  background: var(--shades-50);
  transition: background 0.2s ease;
  cursor: pointer;
}

.category-option:hover {
  background: var(--primary-50);
}

.category-option input[type="radio"] {
  margin: 0;
  margin-top: 0.125rem;
  cursor: pointer;
}

.category-option label {
  font-size: 0.875rem;
  color: var(--shades-600);
  cursor: pointer;
  flex: 1;
  margin: 0;
}

.category-service-name {
  font-weight: 600;
  color: var(--shades-600);
  margin-bottom: 0.25rem;
}

.category-description {
  font-size: 0.8125rem;
  color: var(--shades-400);
  line-height: 1.4;
  margin-top: 0.25rem;
}

.category-clarification textarea {
  width: 100%;
  min-height: 5rem;
  padding: 0.75rem;
  font-size: 0.875rem;
  resize: vertical;
  box-sizing: border-box;
}

.category-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Clarifying Question Card Styles */
.clarifying-question-card {
  padding: 1.25rem;
  margin: 0.9375rem 0;
  max-width: 37.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.clarifying-question-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--shades-600);
  margin: 0;
}

.clarifying-question-text {
  font-size: 0.9375rem;
  color: var(--shades-600);
  margin: 0;
  line-height: 1.5;
}

.clarifying-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.clarifying-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: none;
  border-radius: 0.625rem;
  background: var(--shades-50);
  transition: background 0.2s ease;
  cursor: pointer;
}

.clarifying-option:hover {
  background: var(--primary-50);
}

.clarifying-option input[type="radio"] {
  margin: 0;
  margin-top: 0.25rem;
  cursor: pointer;
}

.clarifying-option-content {
  flex: 1;
  cursor: pointer;
}

.clarifying-option-text {
  font-weight: 500;
  color: var(--shades-600);
  margin-bottom: 0.25rem;
}

.clarifying-option-explanation {
  font-size: 0.8125rem;
  color: var(--shades-400);
  line-height: 1.4;
}

.clarifying-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Source URLs Container */
.source-urls-container {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
}

.source-urls-container a {
  color: var(--primary-500);
  text-decoration: none;
}

.source-urls-container a:hover {
  color: var(--primary-400);
  text-decoration: underline;
}

/* Icon for document links (Font Awesome file-text) */
.source-urls-container .icon-info {
  font-size: 0.8rem;
  line-height: 1;
  display: inline-block;
  flex-shrink: 0;
}

@media (max-width: 48em) {
  .chat-container {
    --chat-padding-x: 0.875rem;
    --chat-padding-y: 0.5rem;
    max-width: 100%;
  }

  .chat-container > .nav-tabs {
    padding-left: var(--chat-padding-x);
    padding-right: var(--chat-padding-x);
  }

  .chat-container > .nav-tabs .nav-tab,
  .chat-container > .nav-tabs .language-button {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
    font-size: 0.8125rem;
  }

  .chat-container > .nav-tabs .nav-tab .hicon {
    font-size: 0.875rem;
  }

  .chat-messages {
    padding: var(--chat-padding-y) var(--chat-padding-x);
  }

  .input-container {
    padding: var(--chat-padding-y) var(--chat-padding-x);
  }

  /* Leave room for the 2.5rem avatar + 0.75rem gap so rows never overflow */
  .message-content {
    max-width: calc(100% - 3.25rem);
    padding: 0.875rem 1rem;
  }

  .bot-message .message-stack {
    max-width: calc(100% - 3.25rem);
  }

  .bot-message .message-text details.transaction-details {
    padding: 0.875rem 1rem 1rem;
  }

  .source-urls-container {
    margin-top: 0.625rem !important;
    padding-top: 0.625rem !important;
  }

  .source-urls-container a {
    font-size: 0.625rem !important;
  }

  .message-actions-footer {
    flex-wrap: wrap;
  }

  .csat-card {
    max-width: 100%;
  }

  .category-selection-card,
  .clarifying-question-card {
    max-width: 100%;
    padding: 1rem;
  }
}

/* Conversation Menu Stack (menu button + user section at top-left) */
.conversation-menu-stack {
  position: fixed;
  top: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  z-index: 1000;
}

/* Conversation Menu Button */
.conversation-menu-button {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.75rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--primary-500);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all 0.2s ease;
  border-radius: 0.5rem;
}

.conversation-menu-stack .conversation-menu-button {
  position: relative;
  top: auto;
  left: auto;
}

.conversation-menu-button:hover {
  color: var(--primary-400);
  background: var(--primary-50);
}

.conversation-menu-button:focus {
  outline: 0.125rem solid var(--primary-500);
  outline-offset: 0.125rem;
}

/* Conversation Sidebar Overlay */
.conversation-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
}

.conversation-sidebar-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(31, 32, 33, 0.5);
  backdrop-filter: blur(0.5rem);
  -webkit-backdrop-filter: blur(0.5rem);
}

.conversation-sidebar {
  position: relative;
  width: 50vw;
  max-width: 90vw;
  height: 100vh;
  background: var(--white);
  box-shadow: 0.25rem 0 1rem rgba(61, 62, 64, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 10000;
  animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.conversation-sidebar-header {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.conversation-sidebar-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--shades-600);
}

.conversation-sidebar-close {
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--shades-400);
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.conversation-sidebar-close:hover {
  color: var(--shades-600);
  background: var(--primary-50);
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.conversation-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.conversation-item {
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: var(--shades-50);
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.conversation-item:hover {
  background: var(--primary-50);
}

.conversation-item.active {
  background: var(--primary-100);
  box-shadow: inset 0 0 0 0.125rem var(--primary-300);
}

.conversation-item.active .conversation-item-name {
  color: var(--primary-700);
  font-weight: 600;
}

.conversation-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.conversation-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--shades-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-new-chat-btn {
  width: 100%;
  margin-bottom: 0.75rem;
}

.conversation-new-chat-btn .hicon {
  font-size: 0.75rem;
}

.conversation-item-date {
  font-size: 0.75rem;
  color: var(--shades-400);
}

/* Pin button (client-side pin, ChatGPT-style) */
.conversation-pin-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--shades-400);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.conversation-pin-btn:hover {
  color: var(--primary-500);
  background: var(--primary-50);
}

.conversation-pin-btn.is-pinned {
  color: var(--primary-600);
}

/* Small pin glyph shown before the name of a pinned chat */
.conversation-item-pin-mark {
  font-size: 0.75rem;
  color: var(--primary-600);
  vertical-align: -0.05em;
}

/* Three action buttons fit better with a tighter row */
.conversation-item {
  gap: 0.25rem;
}

.conversation-pin-btn,
.conversation-delete-btn {
  width: 1.75rem;
  height: 1.75rem;
}

.conversation-delete-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--shades-400);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.conversation-delete-btn:hover {
  color: var(--danger-500);
  background: var(--primary-50);
}

/* Responsive Design */
@media (max-width: 48em) {
  .conversation-menu-stack {
    top: 0.75rem;
    left: 0.75rem;
  }

  .conversation-menu-button {
    top: 0.75rem;
    left: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.625rem;
  }

  .conversation-sidebar {
    width: 80vw;
    max-width: 90vw;
  }

  .conversation-sidebar-header {
    padding: 1rem;
  }

  .conversation-sidebar-header h2 {
    font-size: 1.125rem;
  }

  .conversation-item {
    padding: 0.875rem;
  }

  .conversation-item-name {
    font-size: 0.8125rem;
  }

  .conversation-item-date {
    font-size: 0.6875rem;
  }
}

@media (max-width: 45em) {
  .conversation-sidebar {
    width: 100vw;
  }
}

/* ============================================================
   Responsive — collapse sidebar to off-canvas drawer (ChatGPT mobile)
   ============================================================ */
@media (max-width: 48em) {
  #main-app.app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Sidebar leaves the grid flow (fixed drawer); main takes the only column */
  .app-main {
    grid-column: 1;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(85vw, 20rem);
    z-index: 1100;
    transform: translateX(-100%);
    box-shadow: 0.25rem 0 1.5rem rgba(31, 32, 33, 0.15);
  }

  .app-shell.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-close,
  .header-menu-btn {
    display: inline-flex;
  }

  /* Collapse toggle is desktop-only; mobile uses the off-canvas drawer */
  .sidebar-toggle {
    display: none;
  }

  .app-header {
    padding: 0.625rem 0.75rem;
    gap: 0.5rem;
  }

  .header-logo {
    height: 1.5rem;
  }

  .header-title {
    font-size: 0.9375rem;
  }

  .header-badge {
    display: none;
  }

  .header-lang .language-button {
    padding: 0.35rem 0.5rem;
  }

  .sidebar-footer .sidebar-footer-row {
    width: 100%;
    padding: 0;
  }

  .sidebar-footer .user-navbar,
  .sidebar-footer .user-section-wrapper {
    width: 100%;
  }

  .sidebar-footer .user-section-trigger {
    width: 100%;
    height: auto;
    min-height: 0;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.625rem;
    color: var(--shades-400);
    font-size: 0.8125rem;
  }

  .sidebar-footer .user-section-trigger .hicon {
    font-size: 0.9375rem;
    color: var(--shades-400);
  }

  .sidebar-footer .user-section-label {
    display: block;
    flex: 1;
    color: var(--shades-400);
    font-size: 0.8125rem;
    font-weight: 500;
  }

  .sidebar-footer .user-section-trigger:hover,
  .sidebar-footer .user-section-trigger:focus-visible {
    background: color-mix(in srgb, var(--primary-500) 10%, transparent);
    color: var(--shades-600);
  }

  .sidebar-footer .user-section-trigger:hover .hicon,
  .sidebar-footer .user-section-trigger:hover .user-section-label,
  .sidebar-footer .user-section-trigger:focus-visible .hicon,
  .sidebar-footer .user-section-trigger:focus-visible .user-section-label {
    color: var(--shades-600);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar,
  .sidebar-backdrop {
    transition: none;
  }
}

/* ============================================================
   Header language selector + sidebar user menu placement
   ============================================================ */
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-lang {
  display: flex;
  align-items: center;
}

.header-lang .localization-dropdown.--dropdown {
  display: flex;
  align-items: center;
}

.header-lang .language-button {
  background: transparent;
  color: var(--shades-400);
  border: 0.0625rem solid var(--shades-150);
  border-radius: 0.625rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  backdrop-filter: none;
}

.header-lang .language-button:hover {
  color: var(--shades-600);
  background: var(--primary-50);
  border-color: var(--shades-150);
}

.header-lang .language-button .hicon {
  color: inherit;
}

.header-lang .localization-dropdown__icon-img {
  opacity: 0.72;
}

/* User menu at sidebar bottom — opens upward (ChatGPT-style) */
.sidebar-footer .user-section-wrapper {
  position: relative;
  z-index: 21;
}

.sidebar-footer .user-section-dropdown {
  top: auto;
  bottom: 100%;
  left: 0;
  margin-top: 0;
  margin-bottom: 0.35rem;
  z-index: 10002;
}

@media (min-width: 48.0625em) {
  .sidebar-collapsed .sidebar-footer .user-section-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    overflow: visible;
  }
}

.sidebar-footer .user-section-wrapper:has(.user-section-dropdown.is-open) .user-section-trigger {
  background: color-mix(in srgb, var(--primary-500) 10%, transparent);
  color: var(--shades-600);
  outline: none;
}

.sidebar-footer .user-section-wrapper:has(.user-section-dropdown.is-open) .user-section-trigger .hicon,
.sidebar-footer .user-section-wrapper:has(.user-section-dropdown.is-open) .user-section-trigger .user-section-label {
  color: var(--shades-600);
}

.sidebar-footer .user-navbar {
  display: flex;
  width: 100%;
}

/* Expanded sidebar: account row matches admin panel link (full width + green hover) */
.app-shell:not(.sidebar-collapsed) .sidebar-footer .sidebar-footer-row {
  width: 100%;
  padding: 0;
}

.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-wrapper {
  width: 100%;
}

.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-trigger {
  width: 100%;
  height: auto;
  min-height: 0;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.625rem;
  color: var(--shades-400);
  font-size: 0.8125rem;
}

.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-trigger .hicon {
  font-size: 0.9375rem;
  color: var(--shades-400);
}

.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-label {
  display: block;
  flex: 1;
  color: var(--shades-400);
  font-size: 0.8125rem;
  font-weight: 500;
}

.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-trigger:hover,
.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-trigger:focus-visible {
  background: color-mix(in srgb, var(--primary-500) 10%, transparent);
  color: var(--shades-600);
}

.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-trigger:hover .hicon,
.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-trigger:hover .user-section-label,
.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-trigger:focus-visible .hicon,
.app-shell:not(.sidebar-collapsed) .sidebar-footer .user-section-trigger:focus-visible .user-section-label {
  color: var(--shades-600);
}

/* ───────────────────────────────────────────────────────── Critical case card */

.critical-case-card {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.625rem;
  width: fit-content;
  max-width: 100%;
  padding: 1rem 1.25rem;
  border-radius: var(--default-border-radius);
  border: 0.0625rem solid #ef5350;
  background: color-mix(in srgb, #ef5350 10%, var(--white));
  box-shadow: none;
  animation: slideInMessage 0.25s ease-out;
}

.critical-case-card__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.critical-case-card__icon {
  font-size: 1.125rem;
  color: #d32f2f;
  line-height: 1;
  flex-shrink: 0;
}

.critical-case-card__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #b71c1c;
  line-height: 1.3;
}

.critical-case-card__description {
  font-size: 0.875rem;
  color: var(--shades-600, #444);
  line-height: 1.5;
}

.critical-case-card__phone-block {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.25rem;
}

.critical-case-card__phone-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--shades-500, #666);
}

.critical-case-card__phone-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: #d32f2f;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.critical-case-card__phone-number:hover,
.critical-case-card__phone-number:focus-visible {
  text-decoration: underline;
  color: #b71c1c;
}
