/* ============================================
   CHAT DRAWER - Always a floating drawer
   ============================================ */

/* Chat sheet uses standard .slide-up-sheet from sheets.css */
#chat-view-sheet-overlay {
  /* Inherits from .slide-up-sheet in sheets.css */
}

/* Content inside sheet */
.chat-view-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  background: var(--brokerly-secondary-background);
  position: relative;
  overflow: hidden;
  /* Prevent content from overflowing the sheet */
}

/* ============================================
   HEADER
   ============================================ */

.chat-header-ios {
  background: var(--brokerly-secondary-background);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  position: relative;
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

/* Mobile: simpler header within sheet */
@media (max-width: 768px) {
  .chat-header-content {
    padding: 8px 16px;
  }
}

/* AI Broker Avatar - 40×40px with multicolored gradient border */
.ai-broker-avatar {
  position: relative;
  width: 60px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  padding: 2px;
  background: linear-gradient(135deg,
      #FF6B6B 0%,
      #FFD93D 12.5%,
      #6BCF7F 25%,
      #4D96FF 37.5%,
      #9D4EDD 50%,
      #FF6B9D 62.5%,
      #FFB347 75%,
      #7B68EE 87.5%,
      #FF6B6B 100%);
}

.ai-broker-avatar .avatar-circle-40 {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brokerly-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-broker-avatar .avatar-initial {
  font-size: 20px;
  font-weight: 500;
  color: white;
}

/* Broker Name & Status */
.broker-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.broker-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--brokerly-text-primary);
  margin: 0;
}

.online-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #50C878;
  box-shadow: 0 0 4px rgba(80, 200, 120, 0.5);
}

.status-text {
  font-size: 11px;
  font-weight: 500;
  color: #666666;
}

.header-spacer {
  flex: 1;
}

/* Video Call Button - 24px icon, disabled */
.video-call-button {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--brokerly-primary);
  cursor: not-allowed;
  opacity: 0.6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-call-button svg {
  width: 24px;
  height: 24px;
}

/* Profile Button - 40×40px */
.profile-button-chat {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.profile-avatar-40 {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(26, 127, 230, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-40 .profile-initial {
  font-size: 17px;
  font-weight: 600;
  color: var(--brokerly-primary);
}

/* ============================================
   MESSAGES LIST - Lines 150-182 iOS
   ============================================ */

.chat-messages-ios {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(128, 128, 128, 0.05);
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  /* Important for flex child scrolling */
  pointer-events: auto;
  /* Ensure messages area captures touch events */
  touch-action: pan-y;
  /* Allow vertical scrolling only */
}

/* Message Container */
.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

/* User Message - Right-aligned, Lines 402-424 iOS */
.user-message {
  flex-direction: row-reverse;
  margin-left: 50px;
}

.user-bubble {
  background: var(--modern-card-background);
  /* White background */
  color: var(--brokerly-text-primary);
  /* Dark text */
  padding: 12px 16px;
  border-radius: 20px;
  max-width: 100%;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  /* Subtle shadow like AI bubbles */
}

.user-bubble .bubble-content {
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
}

.user-bubble .bubble-content p {
  margin: 0;
}

.user-bubble .bubble-content p+p {
  margin-top: 8px;
}

.user-bubble .bubble-content h1,
.user-bubble .bubble-content h2,
.user-bubble .bubble-content h3 {
  margin: 12px 0 8px 0;
  font-weight: 600;
  color: var(--brokerly-text-primary);
  /* Ensure headings are dark */
}

.user-bubble .bubble-content code {
  background: rgba(0, 0, 0, 0.05);
  /* Light gray on white */
  color: var(--brokerly-text-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 15px;
}

.user-bubble .bubble-content pre {
  background: rgba(0, 0, 0, 0.05);
  /* Light gray on white */
  color: var(--brokerly-text-primary);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.user-bubble .bubble-content ul,
.user-bubble .bubble-content ol {
  margin: 8px 0;
  padding-left: 20px;
}

.user-bubble .bubble-content li {
  margin: 4px 0;
}

.user-avatar-small {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(26, 127, 230, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar-small span {
  font-size: 11px;
  font-weight: 600;
  color: var(--brokerly-primary);
}

/* AI Message - Left-aligned, Lines 425-468 iOS */
.ai-message {
  flex-direction: column;
  align-items: flex-start;
  margin-right: 50px;
}

.ai-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.ai-message-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--brokerly-text-secondary);
  letter-spacing: 0.3px;
}

.ai-avatar-small {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brokerly-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-avatar-small span {
  font-size: 12px;
  font-weight: 500;
  color: white;
}

/* Assistant Message - Left-aligned side-by-side layout for mobile */
.assistant-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
  margin-right: 50px;
}

.assistant-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--brokerly-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.assistant-avatar-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.assistant-avatar-small span {
  font-size: 12px;
  font-weight: 600;
  color: white;
}

/* AI Avatar Images */
.ai-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ai-message-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.speaker-button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #666666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border-radius: 50%;
}

.speaker-button:hover {
  color: var(--brokerly-primary);
  background: rgba(26, 127, 230, 0.1);
}

/* Speaking state - show pause icon and animate */
.speaker-button.speaking {
  color: var(--brokerly-primary);
  background: rgba(26, 127, 230, 0.15);
  animation: pulse-speaker 1.5s ease-in-out infinite;
}

@keyframes pulse-speaker {

  0%,
  100% {
    background: rgba(26, 127, 230, 0.15);
    transform: scale(1);
  }

  50% {
    background: rgba(26, 127, 230, 0.25);
    transform: scale(1.05);
  }
}

/* Default AI bubble - Clive's light purple theme matching the help banner */
.ai-bubble,
.ai-bubble.clive {
  background: var(--clive-light) !important;
  border: 1.5px solid var(--clive-primary) !important;
  color: var(--brokerly-text-primary) !important;
  padding: 12px 16px;
  border-radius: 20px;
  max-width: 85%;
  /* Only applies to bubble, not siblings */
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(var(--clive-primary-rgb), 0.05) !important;
}

/* Clara's light green theme matching the help banner */
.ai-bubble.clara {
  background: var(--clara-light) !important;
  border: 1.5px solid var(--clara-primary) !important;
  color: var(--brokerly-text-primary) !important;
  box-shadow: 0 4px 12px rgba(var(--clara-primary-rgb), 0.05) !important;
}

/* Bubble Timestamps */
.bubble-timestamp {
  font-size: 11px;
  color: var(--brokerly-text-tertiary, #999);
  margin-top: 4px;
  padding: 0 4px;
  line-height: 1;
}

.user-message .bubble-timestamp {
  text-align: right;
}

.assistant-message .bubble-timestamp,
.ai-message .bubble-timestamp {
  text-align: left;
}

/* Ensure chart containers can be full width */
.message.ai-message>.ai-chart-container {
  max-width: 100%;
  width: 100%;
}

/* Comparison & Spending cards need the full popup width — override margin/max-width */
.ai-message:has(.comparison-embedded),
.ai-message:has(.spending-embedded),
.ai-message:has(.chat-embedded-action-card),
.ai-message:has(.spending-breakdown-card),
.assistant-message:has(.comparison-embedded),
.assistant-message:has(.spending-embedded),
.assistant-message:has(.chat-embedded-action-card),
.assistant-message:has(.spending-breakdown-card) {
  margin-right: 0 !important;
  max-width: 100% !important;
  width: fit-content !important;
}

/* The bubble itself must also expand when it wraps a premium card */
.ai-bubble:has(.comparison-embedded),
.ai-bubble:has(.spending-embedded),
.ai-bubble:has(.chat-embedded-action-card) {
  max-width: 100% !important;
  width: fit-content !important;
  padding: 5px !important;
}

.ai-bubble:has(.spending-breakdown-card) {
  max-width: 100% !important;
  width: 100% !important;
  padding: 8px !important;
}

.ai-bubble .bubble-content {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
}

.ai-bubble .bubble-content p {
  margin: 0;
}

.ai-bubble .bubble-content p+p {
  margin-top: 12px;
}

.ai-bubble .bubble-content h1,
.ai-bubble .bubble-content h2,
.ai-bubble .bubble-content h3 {
  margin: 16px 0 10px 0;
  font-weight: 600;
  color: var(--brokerly-text-primary) !important;
}

.ai-bubble.clive .bubble-content h1,
.ai-bubble.clive .bubble-content h2,
.ai-bubble.clive .bubble-content h3 {
  color: var(--clive-primary) !important;
}

.ai-bubble.clara .bubble-content h1,
.ai-bubble.clara .bubble-content h2,
.ai-bubble.clara .bubble-content h3 {
  color: var(--clara-secondary) !important;
}

[data-theme="dark"] .ai-bubble.clara .bubble-content h1,
[data-theme="dark"] .ai-bubble.clara .bubble-content h2,
[data-theme="dark"] .ai-bubble.clara .bubble-content h3,
.dark-mode .ai-bubble.clara .bubble-content h1,
.dark-mode .ai-bubble.clara .bubble-content h2,
.dark-mode .ai-bubble.clara .bubble-content h3 {
  color: var(--clara-primary) !important;
}

.ai-bubble .bubble-content code {
  background: rgba(128, 128, 128, 0.15) !important;
  color: var(--brokerly-text-primary) !important;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
}

.ai-bubble .bubble-content pre {
  background: rgba(128, 128, 128, 0.1) !important;
  color: var(--brokerly-text-primary) !important;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid rgba(128, 128, 128, 0.15);
}

.ai-bubble .bubble-content ul,
.ai-bubble .bubble-content ol {
  margin: 12px 0;
  padding-left: 24px;
}

.ai-bubble .bubble-content li {
  margin: 6px 0;
  line-height: 1.6;
}

.ai-bubble .bubble-content strong,
.ai-bubble .bubble-content b {
  color: var(--brokerly-text-primary);
  font-weight: 600;
  text-shadow: none;
}

.ai-bubble.clive .bubble-content strong,
.ai-bubble.clive .bubble-content b {
  color: var(--clive-primary) !important;
}

.ai-bubble.clara .bubble-content strong,
.ai-bubble.clara .bubble-content b {
  color: var(--clara-secondary) !important;
}

[data-theme="dark"] .ai-bubble.clara .bubble-content strong,
[data-theme="dark"] .ai-bubble.clara .bubble-content b,
.dark-mode .ai-bubble.clara .bubble-content strong,
.dark-mode .ai-bubble.clara .bubble-content b {
  color: var(--clara-primary) !important;
}

.ai-bubble .bubble-content a {
  color: var(--clive-primary) !important;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

/* ===== PREMIUM DYNAMIC SPENDING BREAKDOWN COMPONENT ===== */

.spending-breakdown-card {
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--clara-glow);
  border-radius: 24px;
  padding: 20px;
  margin: 18px 0 10px 0;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  width: 100%;
  box-sizing: border-box;
  color: #1A3038;
}

.breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(102, 201, 186, 0.25);
  padding-bottom: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.breakdown-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breakdown-header-icon {
  color: #2E7D73;
  filter: drop-shadow(0 0 2px rgba(46, 125, 115, 0.2));
}

.breakdown-title {
  color: #1A3038;
  font-weight: 800;
  font-size: 17.5px;
  letter-spacing: -0.015em;
}

.breakdown-subtitle {
  font-size: 11px;
  color: #2E7D73;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.compact-breakdown-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(102, 201, 186, 0.15);
  box-sizing: border-box;
  width: 100%;
}

.compact-breakdown-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.compact-breakdown-row:first-child {
  padding-top: 0;
}

.row-top-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.row-category {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-category-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row-category-top {
  display: flex;
  align-items: center;
}

.row-category-sub {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-icon-wrapper {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.row-icon-wrapper svg {
  width: 13px !important;
  height: 13px !important;
}

/* Category specific glow-schemes - high-contrast light variants */
.row-icon-wrapper.cat-food {
  background: rgba(255, 110, 64, 0.1);
  color: #D84315;
  border: 1px solid rgba(255, 110, 64, 0.18);
}
.row-icon-wrapper.cat-utilities {
  background: rgba(251, 192, 45, 0.12);
  color: #F57F17;
  border: 1px solid rgba(251, 192, 45, 0.18);
}
.row-icon-wrapper.cat-shopping {
  background: rgba(240, 98, 146, 0.1);
  color: #C2185B;
  border: 1px solid rgba(240, 98, 146, 0.18);
}
.row-icon-wrapper.cat-housing {
  background: rgba(2, 136, 209, 0.1);
  color: #0288D1;
  border: 1px solid rgba(2, 136, 209, 0.18);
}
.row-icon-wrapper.cat-transport {
  background: rgba(0, 150, 136, 0.1);
  color: #00796B;
  border: 1px solid rgba(0, 150, 136, 0.18);
}
.row-icon-wrapper.cat-entertainment {
  background: rgba(123, 31, 162, 0.1);
  color: #7B1FA2;
  border: 1px solid rgba(123, 31, 162, 0.18);
}
.row-icon-wrapper.cat-insurance {
  background: rgba(48, 63, 159, 0.1);
  color: #303F9F;
  border: 1px solid rgba(48, 63, 159, 0.18);
}
.row-icon-wrapper.cat-savings {
  background: rgba(0, 172, 193, 0.1);
  color: #0097A7;
  border: 1px solid rgba(0, 172, 193, 0.18);
}
.row-icon-wrapper.cat-other {
  background: rgba(97, 97, 97, 0.06);
  color: #616161;
  border: 1px solid rgba(97, 97, 97, 0.12);
}

.row-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #1A3038;
}

.row-percent {
  font-size: 11px;
  color: #5A737E;
  font-weight: 600;
}

.row-amount {
  font-size: 14.5px;
  font-weight: 800;
  color: #1A3038;
}



.row-description-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #5A737E;
  margin-top: 1px;
  box-sizing: border-box;
  width: 100%;
  border-left: 2px solid transparent;
  padding-left: 8px;
}

.opportunity-text {
  flex: 1;
  padding-top: 2px;
}

.opportunity-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.row-description-line.status-warning {
  color: #C62828;
}

.row-description-line.status-success {
  color: #00695C;
}

.row-description-line.status-info {
  color: #0277BD;
}

.row-description-line strong {
  color: inherit !important;
  font-weight: 750;
  margin-right: 4px;
}

/* Responsive adjust for ultra small viewports */
@media (max-width: 360px) {
  .row-top-line {
    flex-wrap: wrap;
    gap: 6px;
  }
  .row-amount {
    width: 100%;
    text-align: right;
    margin-top: -2px;
  }
}

/* ===== PREMIUM GENERAL TABLE STYLING FOR FALLBACK ===== */

.ai-table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
  border-radius: 12px;
}

/* Ensure horizontal scrollbar looks premium and fits modern design system */
.ai-table-container::-webkit-scrollbar {
  height: 5px;
}
.ai-table-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}
.ai-table-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}
.ai-table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ai-bubble .bubble-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0; /* Reset margin since container handles it */
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(128, 128, 128, 0.15) !important;
  background: rgba(128, 128, 128, 0.05) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13.5px;
}

.ai-bubble .bubble-content th {
  background: rgba(128, 128, 128, 0.1) !important;
  color: var(--brokerly-text-primary) !important;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15) !important;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.ai-bubble .bubble-content td {
  padding: 10px 12px;
  color: var(--brokerly-text-primary) !important;
  border-bottom: 1px solid rgba(128, 128, 128, 0.08) !important;
  transition: background 0.2s ease;
}

.ai-bubble .bubble-content tr:last-child td {
  border-bottom: none !important;
}

.ai-bubble .bubble-content tr:nth-child(even) {
  background: rgba(128, 128, 128, 0.03) !important;
}

.ai-bubble .bubble-content tr:hover td {
  background: rgba(128, 128, 128, 0.06) !important;
}

.ai-bubble .bubble-content a,
.ai-bubble.clive .bubble-content a {
  color: var(--clive-primary) !important;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.ai-bubble.clara .bubble-content a {
  color: var(--clara-secondary) !important;
  border-bottom: 1px solid var(--clara-primary);
  text-decoration: none;
}

[data-theme="dark"] .ai-bubble.clara .bubble-content a,
.dark-mode .ai-bubble.clara .bubble-content a {
  color: var(--clara-primary) !important;
  border-bottom: 1px solid var(--clara-primary);
}

.ai-bubble .bubble-content a:hover,
.ai-bubble.clive .bubble-content a:hover,
.ai-bubble.clara .bubble-content a:hover {
  opacity: 0.8;
}

/* Typing Indicator - 3 Pulsing Dots */
.typing-bubble {
  padding: 12px 20px;
  width: auto;
  display: inline-block;
  border-radius: 20px;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.typing-bubble.clive {
  background: rgba(var(--clive-primary-rgb), 0.06) !important;
  border: 1px solid rgba(var(--clive-primary-rgb), 0.2) !important;
  box-shadow: 0 4px 15px rgba(var(--clive-primary-rgb), 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
}

.typing-bubble.clara {
  background: rgba(var(--clara-primary-rgb), 0.06) !important;
  border: 1px solid rgba(var(--clara-primary-rgb), 0.2) !important;
  box-shadow: 0 4px 15px rgba(var(--clara-primary-rgb), 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .typing-bubble.clive,
.dark-mode .typing-bubble.clive {
  background: rgba(var(--clive-primary-rgb), 0.1) !important;
  border: 1px solid rgba(var(--clive-primary-rgb), 0.3) !important;
  box-shadow: 0 4px 20px rgba(var(--clive-primary-rgb), 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .typing-bubble.clara,
.dark-mode .typing-bubble.clara {
  background: rgba(var(--clara-primary-rgb), 0.1) !important;
  border: 1px solid rgba(var(--clara-primary-rgb), 0.3) !important;
  box-shadow: 0 4px 20px rgba(var(--clara-primary-rgb), 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
}

.typing-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.typing-dots span,
.typing-dots .typing-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.typing-dots.clive span,
.typing-dots.clive .typing-dot {
  background: var(--clive-primary) !important;
  box-shadow: 0 0 8px rgba(var(--clive-primary-rgb), 0.4);
  animation: typingDotModernClive 1.4s ease-in-out infinite;
}

.typing-dots.clara span,
.typing-dots.clara .typing-dot {
  background: var(--clara-primary) !important;
  box-shadow: 0 0 8px rgba(var(--clara-primary-rgb), 0.4);
  animation: typingDotModernClara 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(1),
.typing-dots .typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dots span:nth-child(2),
.typing-dots .typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3),
.typing-dots .typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDotModernClive {
  0%, 60%, 100% {
    transform: translateY(0) scale(0.85);
    opacity: 0.4;
    box-shadow: 0 0 0 rgba(var(--clive-primary-rgb), 0);
  }
  30% {
    transform: translateY(-5px) scale(1.15);
    opacity: 1;
    box-shadow: 0 4px 10px rgba(var(--clive-primary-rgb), 0.6);
  }
}

@keyframes typingDotModernClara {
  0%, 60%, 100% {
    transform: translateY(0) scale(0.85);
    opacity: 0.4;
    box-shadow: 0 0 0 rgba(var(--clara-primary-rgb), 0);
  }
  30% {
    transform: translateY(-5px) scale(1.15);
    opacity: 1;
    box-shadow: 0 4px 10px rgba(var(--clara-primary-rgb), 0.6);
  }
}

/* ============================================
   INPUT INTERFACE - Lines 184-261 iOS
   ============================================ */

.chat-input-interface {
  background: var(--brokerly-secondary-background);
  position: relative;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Mobile: Make input bigger with better UX */
@media (max-width: 768px) {
  .chat-input-interface {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--brokerly-secondary-background);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  }
}

.input-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.05);
}

.input-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

/* Mobile: Bigger, better input container */
@media (max-width: 768px) {
  .input-container {
    gap: 16px;
    padding: 0;
    /* Padding now on parent .chat-input-interface */
  }
}

/* Text Input Wrapper - 44px height, pill shape */
.text-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--brokerly-input-background);
  border: 1px solid var(--brokerly-border-subtle);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input-wrapper:focus-within {
  border-color: var(--brokerly-primary);
  box-shadow: 0 0 0 3px rgba(26, 127, 230, 0.1);
}

/* Mobile: Bigger input for better touch */
@media (max-width: 768px) {
  .text-input-wrapper {
    height: 52px;
    border-radius: 26px;
    border-width: 1.5px;
  }
}

.chat-text-input {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0 16px;
  font-size: 17px;
  font-weight: 400;
  color: var(--brokerly-text-primary);
  outline: none;
  position: relative;
  z-index: 2;
}

/* Mobile: Bigger text for better readability */
@media (max-width: 768px) {
  .chat-text-input {
    font-size: 18px;
    padding: 0 20px;
  }
}

.chat-text-input::placeholder {
  color: var(--brokerly-text-tertiary);
}

/* Waveform Container - 24 bars */
.waveform-container {
  position: absolute;
  left: 16px;
  right: 48px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  z-index: 1;
  pointer-events: none;
  /* Allow clicks to pass through to input */
}

.waveform-bar {
  flex: 1;
  background: var(--brokerly-primary);
  border-radius: 2px;
  min-height: 2px;
  transition: height 0.05s ease-out;
}

/* Clear Button - X icon, 20px */
.clear-button {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--brokerly-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
}

.clear-button:hover {
  opacity: 0.7;
}

/* Voice Button - 44×44px circle */
.voice-button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(128, 128, 128, 0.1);
  color: var(--brokerly-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease-out;
}

.voice-button:hover {
  background: rgba(128, 128, 128, 0.15);
}

.voice-button.recording {
  background: rgba(255, 0, 0, 0.1);
  color: #FF0000;
  transform: scale(1.1);
}

.voice-button svg {
  width: 20px;
  height: 20px;
}

/* Send Button - 44×44px circle, brokerlyPrimary */
.send-button-ios {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--brokerly-primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease-out;
  flex-shrink: 0;
}

.send-button-ios:hover:not(:disabled) {
  transform: scale(1.05);
}

.send-button-ios:active:not(:disabled) {
  transform: scale(0.95);
}

.send-button-ios:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.send-button-ios svg {
  width: 20px;
  height: 20px;
}

/* Mobile: Bigger send button for better touch */
@media (max-width: 768px) {
  .send-button-ios {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
  }

  .send-button-ios svg {
    width: 24px;
    height: 24px;
  }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .user-message {
    margin-left: 8px !important;
  }

  .ai-message {
    margin-right: 8px !important;
  }

  .assistant-message {
    margin-right: 8px !important;
  }

  .chat-messages-ios {
    padding: 8px !important;
    gap: 12px !important;
  }

  .ai-bubble,
  .ai-bubble.clive,
  .ai-bubble.clara {
    max-width: 95% !important;
    padding: 10px 14px !important;
  }

  .user-bubble {
    max-width: 95% !important;
    padding: 10px 14px !important;
  }

  .ai-bubble .bubble-content,
  .user-bubble .bubble-content {
    font-size: 14.5px !important;
    line-height: 1.5 !important;
  }

  .ai-bubble .bubble-content p+p,
  .user-bubble .bubble-content p+p {
    margin-top: 8px !important;
  }

  .ai-bubble .bubble-content h1,
  .user-bubble .bubble-content h1 {
    font-size: 16.5px !important;
    margin: 12px 0 6px 0 !important;
  }
  .ai-bubble .bubble-content h2,
  .user-bubble .bubble-content h2 {
    font-size: 15px !important;
    margin: 12px 0 6px 0 !important;
  }
  .ai-bubble .bubble-content h3,
  .user-bubble .bubble-content h3 {
    font-size: 14px !important;
    margin: 10px 0 6px 0 !important;
  }

  .ai-bubble .bubble-content ul,
  .ai-bubble .bubble-content ol,
  .user-bubble .bubble-content ul,
  .user-bubble .bubble-content ol {
    margin: 8px 0 !important;
    padding-left: 18px !important;
  }

  .ai-bubble .bubble-content li,
  .user-bubble .bubble-content li {
    margin: 4px 0 !important;
    line-height: 1.45 !important;
  }

  .ai-bubble .bubble-content code,
  .user-bubble .bubble-content code {
    font-size: 12.5px !important;
  }

  .ai-bubble .bubble-content pre,
  .user-bubble .bubble-content pre {
    padding: 8px !important;
    margin: 8px 0 !important;
    border-radius: 6px !important;
  }

  /* Spending breakdown card mobile adjustments */
  .spending-breakdown-card {
    padding: 12px !important;
    margin: 12px 0 8px 0 !important;
    border-radius: 16px !important;
  }

  .breakdown-title {
    font-size: 14.5px !important;
  }

  .breakdown-subtitle {
    font-size: 10px !important;
  }

  .row-name {
    font-size: 12.5px !important;
  }

  .row-amount {
    font-size: 13.5px !important;
  }

  .row-percent {
    font-size: 10px !important;
    color: var(--brokerly-text-secondary) !important;
    display: inline-block !important;
  }

  .row-description-line {
    font-size: 11px !important;
    margin-top: 6px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .opportunity-actions {
    display: flex !important;
    justify-content: flex-start !important;
    margin-top: 4px !important;
    width: 100% !important;
    gap: 6px !important;
  }

  .opportunity-actions .carbon-btn {
    flex: 1 !important;
    justify-content: center !important;
    padding: 6px 10px !important;
    font-size: 11.5px !important;
    height: auto !important;
  }

  .compact-breakdown-row {
    padding: 10px 0 !important;
  }

  /* Thread container mobile adjustments for wider bubbles */
  .chat-thread-container {
    margin: 12px 4px !important;
    padding: 8px 8px 8px 16px !important;
  }
  .chat-thread-line {
    left: 8px !important;
  }
  .chat-thread-container .user-message {
    margin-left: 0px !important;
  }
  .chat-thread-container .ai-message {
    margin-right: 0px !important;
  }
  .chat-thread-container .assistant-message {
    margin-right: 0px !important;
  }
}


/* ============================================
   TYPING INDICATOR
   ============================================ */

.typing-indicator-ios {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin: 4px 0;
  opacity: 0;
  animation: fadeIn 0.3s ease-in forwards;
}

.typing-indicator-ios.hidden {
  display: none;
}

.message-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg,
      #FF6B6B 0%,
      #FFD93D 12.5%,
      #6BCF7F 25%,
      #4D96FF 37.5%,
      #9D4EDD 50%,
      #FF6B9D 62.5%,
      #FFB347 75%,
      #7B68EE 87.5%,
      #FF6B6B 100%);
  padding: 2px;
  flex-shrink: 0;
}

.message-avatar-small-inner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brokerly-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-avatar-small-letter {
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.typing-indicator-ios .typing-dots,
.typing-indicator-ios .typing-dots.clive {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(var(--clive-primary-rgb), 0.06) !important;
  border: 1px solid rgba(var(--clive-primary-rgb), 0.2) !important;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(var(--clive-primary-rgb), 0.08) !important;
}

.typing-indicator-ios .typing-dots.clara {
  background: rgba(var(--clara-primary-rgb), 0.06) !important;
  border: 1px solid rgba(var(--clara-primary-rgb), 0.2) !important;
  box-shadow: 0 4px 15px rgba(var(--clara-primary-rgb), 0.08) !important;
}

.typing-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.typing-dots.clive .typing-dot {
  background: var(--clive-primary) !important;
  box-shadow: 0 0 8px rgba(var(--clive-primary-rgb), 0.4);
  animation: typingDotModernClive 1.4s ease-in-out infinite;
}

.typing-dots.clara .typing-dot {
  background: var(--clara-primary) !important;
  box-shadow: 0 0 8px rgba(var(--clara-primary-rgb), 0.4);
  animation: typingDotModernClara 1.4s ease-in-out infinite;
}

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

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

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* ============================================
   CHAT QUICK ACTIONS
   ============================================ */
.chat-quick-actions-container {
  display: flex;
  gap: 8px;
  padding: 12px 16px 4px 16px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  background: transparent;
}

.chat-quick-actions-container::-webkit-scrollbar {
  display: none; /* Safari/Chrome */
}

.chat-quick-action-pill {
  display: flex;
  align-items: center;
  gap: 8px; /* Increased gap */
  padding: 10px 16px; /* Slightly more padding */
  background: var(--pill-bg, rgba(128, 128, 128, 0.1));
  color: var(--brokerly-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  font-size: 14px; /* Slightly larger */
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.04);
}

.chat-quick-action-pill:hover {
  transform: translateY(-2px);
  background: var(--pill-bg, rgba(128, 128, 128, 0.15));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.chat-quick-action-pill .pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pill-color, var(--brokerly-text-secondary));
  transition: transform 0.3s ease;
}

.chat-quick-action-pill:hover .pill-icon {
  transform: scale(1.2);
}

.chat-quick-action-pill .pill-icon svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   CHAT THREADS (Smart Compare Grouping)
   ============================================ */

.chat-thread-container {
  position: relative;
  margin: 16px 8px;
  padding: 12px 12px 12px 24px; /* Space for the thread line */
  background: transparent;
  border-radius: var(--radius-lg);
  border: none;
  transition: all var(--transition-normal);
}

.chat-thread-line {
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 12px;
  width: 3px; /* Slightly thicker */
  background: var(--thread-accent, var(--comparison-accent, #7c3aed));
  border-radius: 4px;
  opacity: 0.9;
  animation: threadLinePulse 4s ease-in-out infinite;
}

@keyframes threadLinePulse {
  0%, 100% { opacity: 0.7; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.3); }
}

/* Add a dot at the start and end of the thread line */
.chat-thread-line::before,
.chat-thread-line::after {
  content: '';
  position: absolute;
  left: -4.5px; /* Centered on 3px line: (12 - 3) / 2 = 4.5 */
  width: 12px; /* Increased from 8px */
  height: 12px; /* Increased from 8px */
  border-radius: 50%;
  background: var(--thread-accent, var(--comparison-accent, #7c3aed));
  box-shadow: 0 0 10px var(--thread-accent);
}

.chat-thread-line::before {
  top: -6px;
}

.chat-thread-line::after {
  bottom: -6px;
}

.chat-thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--comparison-text-secondary, #475569);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--thread-bg, rgba(139, 92, 246, 0.06));
  border: 1px solid var(--thread-border, rgba(139, 92, 246, 0.15));
  padding: 8px 12px;
  border-radius: 10px;
}

.chat-thread-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-thread-time {
  font-weight: 400;
  opacity: 0.7;
  text-transform: none;
  font-size: 11px;
}

.chat-thread-time::before {
  content: '·';
  margin-right: 6px;
}

.chat-thread-actions {
  display: flex;
  gap: 8px;
}

.chat-thread-btn {
  background: transparent;
  border: none;
  color: var(--comparison-text-secondary, #475569);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.chat-thread-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.chat-thread-btn.cancel {
  color: var(--brokerly-danger, #FF3B30);
}

/* Collapsed state */
.chat-thread-container.collapsed .chat-thread-content {
  display: none;
}

.chat-thread-container.collapsed {
  padding: 12px 16px;
}

.chat-thread-container.collapsed .chat-thread-line {
  display: none;
}

/* Mobile Close Button (default hidden on desktop) */
.mobile-chat-close {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(128, 128, 128, 0.1);
  color: var(--brokerly-text-secondary);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  outline: none;
}

.mobile-chat-close:active {
  background: rgba(128, 128, 128, 0.2);
  transform: scale(0.95);
}

.mobile-chat-close svg {
  width: 20px;
  height: 20px;
}

/* Mobile adjustments: Hide video-call, speaker, profile, and announcements icons on mobile viewports */
@media (max-width: 768px) {
  .video-call-button,
  .speaker-button,
  #profile-button-chat,
  #product-announce-btn-chat {
    display: none !important;
  }

  /* Chat sheet content glowing top edge */
  #chat-view-sheet-overlay .sheet-content::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 4px !important;
    background: linear-gradient(90deg,
      rgba(255, 111, 97, 0.9) 0%,
      rgba(255, 215, 0, 0.9) 20%,
      rgba(80, 200, 120, 0.9) 40%,
      rgba(0, 158, 217, 0.9) 60%,
      rgba(26, 127, 230, 0.9) 80%,
      rgba(255, 111, 97, 0.9) 100%
    ) !important;
    background-size: 200% 100% !important;
    z-index: 10 !important;
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
    animation: chat-stripe-slide-horizontal 6s ease-in-out infinite !important;
    box-shadow: 0 2px 10px rgba(255, 111, 97, 0.3) !important;
  }

  /* Hide standard sheet header on mobile for chat to remove double header */
  #chat-view-sheet-overlay .sheet-header {
    display: none !important;
  }

  /* Show mobile close button */
  .mobile-chat-close {
    display: flex !important;
  }

  /* Adjust sheet handle margin to be less wasteful */
  #chat-view-sheet-overlay .sheet-handle {
    margin: 8px auto 8px !important;
  }

  /* Make the drawer taller on mobile */
  #chat-view-sheet-overlay .sheet-content {
    max-height: calc(95vh - env(safe-area-inset-bottom, 0px)) !important;
    overflow: hidden !important; /* Clip glowing edge overflow */
  }

  /* Round top corners of the chat header since sheet header is hidden */
  .chat-header-ios {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
  }

  /* Ultra compact padding in header content */
  .chat-header-content {
    padding: 4px 10px !important;
  }

  /* Shrink header team avatars and info */
  .ai-broker-avatar {
    width: 52px !important;
    height: 36px !important;
    border-radius: 18px !important;
    padding: 1.5px !important;
  }

  .ai-broker-avatar .avatar-circle-40 {
    width: 32px !important;
    height: 32px !important;
  }

  .ai-broker-avatar .avatar-initial {
    font-size: 15px !important;
  }

  .chat-header-ios .team-avatar-container {
    width: 48px !important;
    height: 32px !important;
  }

  .chat-header-ios .team-avatar.clive {
    width: 32px !important;
    height: 32px !important;
  }

  .chat-header-ios .team-avatar.clara {
    left: 14px !important;
    width: 32px !important;
    height: 32px !important;
  }

  .broker-name {
    font-size: 15px !important;
  }

  .status-text {
    font-size: 10px !important;
  }

  /* Prevent avatar compression */
  .user-avatar-small,
  .assistant-avatar-small,
  .ai-avatar-small {
    flex-shrink: 0 !important;
  }

  /* Message width optimizations to prevent horizontal squeezing */
  .user-bubble {
    max-width: calc(100% - 36px) !important;
  }

  .assistant-message > div[style*="max-width: 85%"] {
    max-width: calc(100% - 36px) !important;
  }

  .ai-bubble,
  .ai-bubble.clive,
  .ai-bubble.clara {
    max-width: 100% !important;
  }

  /* Input interface optimization for space efficiency */
  .chat-input-interface {
    padding: 4px 6px !important;
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .input-container {
    gap: 6px !important;
    padding: 0 !important;
    margin-top: 4px !important; /* Space below the divider */
  }

  .text-input-wrapper {
    height: 44px !important;
    border-radius: 22px !important;
  }

  .chat-text-input {
    font-size: 15px !important;
    padding: 0 10px !important;
  }

  .send-button-ios {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }

  .send-button-ios svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* Smaller quick actions on mobile */
  .chat-quick-action-pill {
    padding: 5px 10px !important;
    font-size: 11.5px !important;
    gap: 4px !important;
  }

  .chat-quick-action-pill .pill-icon svg {
    width: 15px !important;
    height: 15px !important;
  }

  /* Symmetrical vertical and horizontal alignment for quick actions container on mobile */
  .chat-quick-actions-container {
    padding: 0 0 4px 0 !important; /* Space: top=0, bottom=4px, sides=0 */
    margin: 0 !important;
    display: flex;
    gap: 6px !important;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Theme-aware Chat Download Buttons (PDF/CSV) */
.chat-download-btn {
  padding: 6px 12px;
  font-size: 12px;
  height: auto;
  border-radius: 8px;
  font-weight: 700;
  gap: 6px;
  flex-shrink: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  background: rgba(0, 0, 0, 0.05) !important;
  color: var(--brokerly-text-primary) !important;
}

.chat-download-btn:hover {
  background: rgba(0, 0, 0, 0.08) !important;
}

.chat-download-btn.compact {
  font-size: 11px !important;
  padding: 4px 10px !important;
}

html[data-theme="dark"] .chat-download-btn,
.dark-mode .chat-download-btn {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

html[data-theme="dark"] .chat-download-btn:hover,
.dark-mode .chat-download-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chat-download-btn {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
  }
  :root:not([data-theme="light"]) .chat-download-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
  }
}