/* ==========================================================================
   Agent Chat - Canvas Design System
   Inspired by Gobii recruiting solutions aesthetic
   ========================================================================== */

/* ==========================================================================
   Canvas Background - Flat, paper-like, beautiful
   Container scrolling architecture for mobile viewport stability
   ========================================================================== */

.agent-chat-page {
  --agent-chat-sidebar-width: 18rem;
  --agent-chat-sidebar-width-collapsed: 5rem;
  --agent-chat-sidebar-width-gallery: 34rem;
  --agent-chat-gallery-conversation-width: 25rem;
  --agent-chat-purple-base: #1e1145;
  --agent-chat-purple-background:
    radial-gradient(ellipse at 25% 0%, rgba(64, 27, 104, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(64, 27, 104, 0.1) 0%, transparent 50%),
    linear-gradient(175deg, #401B68 0%, #1c0f42 55%, #170d38 100%);
  --agent-chat-grain-texture: none;
  position: relative;
  /* Use dvh for dynamic mobile viewport (adjusts with address bar) */
  height: 100vh;
  height: 100dvh;
  /* Flex container for banner + content + composer */
  display: flex;
  flex-direction: column;
  isolation: isolate;
  overflow: hidden; /* Prevent body scroll - timeline scrolls internally */
  /* Super-light purple gradient background */
  background:
    radial-gradient(ellipse 120% 80% at 20% 10%, rgba(139, 92, 246, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 100% 70% at 85% 20%, rgba(124, 58, 237, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse 140% 100% at 50% 100%, rgba(139, 92, 246, 0.05) 0%, rgba(124, 58, 237, 0.02) 40%, transparent 70%),
    linear-gradient(to bottom, #fbf9ff 0%, #f9f7fe 100%);
}

/* Ambient shimmer — visible only while the agent is actively processing */
.agent-chat-page::after {
  content: '';
  position: absolute;
  /* Oversize so the drift translate doesn't expose edges */
  inset: -15%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  background:
    radial-gradient(ellipse 60% 45% at 25% 25%, rgba(139, 92, 246, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 72% 68%, rgba(124, 58, 237, 0.055) 0%, transparent 65%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(167, 139, 250, 0.04) 0%, transparent 60%);
  animation: ambientDrift 10s ease-in-out infinite;
  will-change: transform;
}

.agent-chat-page[data-processing="true"]::after {
  opacity: 1;
}

@keyframes ambientDrift {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(2%, -1.5%) scale(1.02); }
  50%  { transform: translate(-1%, 2%) scale(0.98); }
  75%  { transform: translate(1.5%, 0.5%) scale(1.01); }
  100% { transform: translate(0, 0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .agent-chat-page::after {
    animation: none;
  }
}

@media (min-width: 768px) {
  .agent-chat-page--framed {
    --agent-chat-frame-padding: 0.75rem;
    --agent-chat-sidebar-frame-gap: 0rem;
    --agent-chat-frame-radius: 0.875rem;
    background-color: var(--agent-chat-purple-base);
    background: var(--agent-chat-purple-background);
  }

  .agent-chat-page--framed::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
    background-image: var(--agent-chat-grain-texture);
    background-size: 200px 200px;
    background-repeat: repeat;
    mix-blend-mode: screen;
  }

  .agent-chat-page--framed .chat-sidebar {
    background: transparent;
    border-right-color: transparent;
  }

  .agent-chat-page--framed .chat-sidebar::before,
  .agent-chat-page--framed .chat-sidebar::after {
    display: none;
  }
}

/* ==========================================================================
   Banner - Glassmorphic header bar
   ========================================================================== */

.banner-shell {
  position: fixed;
  top: 0;
  left: var(--agent-chat-sidebar-current-width, var(--agent-chat-sidebar-width, 18rem));
  right: 0;
  z-index: 25;
  transition: left 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.chat-sidebar[data-sidebar-mode='collapsed'],
.agent-chat-main[data-sidebar-mode='collapsed'],
.banner-shell[data-sidebar-mode='collapsed'] {
  --agent-chat-sidebar-current-width: var(--agent-chat-sidebar-width-collapsed, 5rem);
}

.chat-sidebar[data-sidebar-mode='list'],
.agent-chat-main[data-sidebar-mode='list'],
.banner-shell[data-sidebar-mode='list'] {
  --agent-chat-sidebar-current-width: var(--agent-chat-sidebar-width, 18rem);
}

.chat-sidebar[data-sidebar-mode='gallery'],
.agent-chat-main[data-sidebar-mode='gallery'],
.banner-shell[data-sidebar-mode='gallery'] {
  --agent-chat-sidebar-current-width: var(--agent-chat-sidebar-width-gallery, 34rem);
}

@media (max-width: 767px) {
  .banner-shell {
    left: 0;
    top: 0;
  }
}

@media (min-width: 768px) {
  .agent-chat-page--framed .banner-shell {
    top: var(--agent-chat-frame-padding, 0.75rem);
    right: var(--agent-chat-frame-padding, 0.75rem);
    left: calc(var(--agent-chat-sidebar-current-width, var(--agent-chat-sidebar-width, 18rem)) + var(--agent-chat-sidebar-frame-gap, 0rem));
    transition: left 0.24s cubic-bezier(0.22, 1, 0.36, 1), right 0.24s cubic-bezier(0.22, 1, 0.36, 1), top 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .agent-chat-page--framed .banner {
    border-top-left-radius: var(--agent-chat-frame-radius, 0.875rem);
    border-top-right-radius: var(--agent-chat-frame-radius, 0.875rem);
  }
}

.banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  container-type: inline-size;
  container-name: agent-chat-banner;
  width: 100%;
  padding: 0.625rem 1.25rem;
  overflow: hidden;
  background: rgba(221, 214, 254, 0.42);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
  box-shadow: 0 1px 4px rgba(30, 17, 69, 0.06);
  pointer-events: auto;
}

@media (min-width: 768px) {
  .chat-sidebar[data-sidebar-mode='gallery'],
  .agent-chat-main[data-sidebar-mode='gallery'],
  .banner-shell[data-sidebar-mode='gallery'] {
    --agent-chat-sidebar-current-width: calc(100vw - var(--agent-chat-gallery-conversation-width, 25rem));
  }

  .agent-chat-page--framed .chat-sidebar[data-sidebar-mode='gallery'],
  .agent-chat-page--framed .agent-chat-main[data-sidebar-mode='gallery'],
  .agent-chat-page--framed .banner-shell[data-sidebar-mode='gallery'] {
    --agent-chat-sidebar-current-width: calc(
      100vw - var(--agent-chat-gallery-conversation-width, 25rem) - var(--agent-chat-frame-padding, 0.75rem)
    );
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner,
  .banner-shell[data-sidebar-mode='gallery'] .banner-secondary {
    width: min(var(--agent-chat-gallery-conversation-width, 25rem), 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner {
    padding: 0.5rem 0.875rem;
    gap: 0.5rem;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-left {
    gap: 0.5rem;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-avatar {
    width: 2rem;
    height: 2rem;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-avatar-text {
    font-size: 0.6875rem;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-name {
    font-size: 0.8125rem;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-task-title {
    max-width: 11rem;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-contact-text,
  .banner-shell[data-sidebar-mode='gallery'] .banner-connection-label,
  .banner-shell[data-sidebar-mode='gallery'] .banner-connection-check,
  .banner-shell[data-sidebar-mode='gallery'] .banner-desktop-only {
    display: none;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-mobile-only {
    display: inline-flex;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-contact-link {
    padding: 0.25rem;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-contact-link svg {
    opacity: 1;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-upgrade {
    padding: 0.375rem;
    margin-right: 0.25rem;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-upgrade span {
    display: none;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-right {
    gap: 0.375rem;
    padding-left: 0.5rem;
  }

  .banner-shell[data-sidebar-mode='gallery'] .banner-close,
  .banner-shell[data-sidebar-mode='gallery'] .banner-settings {
    width: 1.5rem;
    height: 1.5rem;
  }
}

.banner-secondary {
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.high-priority-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  width: 100%;
  padding: 0.62rem 1.25rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(90deg, rgba(254, 243, 199, 0.97) 0%, rgba(255, 237, 213, 0.97) 100%);
  color: #7c2d12;
}

.high-priority-banner--critical {
  border-bottom-color: rgba(225, 29, 72, 0.35);
  background: linear-gradient(90deg, rgba(254, 226, 226, 0.98) 0%, rgba(254, 202, 202, 0.98) 100%);
  color: #7f1d1d;
}

.high-priority-banner-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.high-priority-banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.2);
  color: #b45309;
  flex-shrink: 0;
}

.high-priority-banner--critical .high-priority-banner-icon {
  background: rgba(244, 63, 94, 0.18);
  color: #be123c;
}

.high-priority-banner-copy {
  min-width: 0;
}

.high-priority-banner-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.high-priority-banner-message {
  margin: 0.1rem 0 0;
  font-size: 0.77rem;
  line-height: 1.35;
}

.high-priority-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.high-priority-banner-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid rgba(185, 28, 28, 0.2);
  border-radius: 999px;
  padding: 0.27rem 0.72rem;
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 700;
  color: inherit;
  background: rgba(255, 255, 255, 0.52);
}

.high-priority-banner-link:hover {
  background: rgba(255, 255, 255, 0.68);
}

.high-priority-banner-link:focus-visible {
  outline: 2px solid rgba(225, 29, 72, 0.4);
  outline-offset: 2px;
}

.high-priority-banner-dismiss {
  border: none;
  background: transparent;
  color: inherit;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.high-priority-banner-dismiss:hover {
  background: rgba(255, 255, 255, 0.4);
}

.high-priority-banner-dismiss:focus-visible {
  outline: 2px solid rgba(225, 29, 72, 0.4);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .high-priority-banner {
    flex-wrap: wrap;
    padding: 0.62rem 0.8rem;
  }

  .high-priority-banner-actions {
    margin-left: 2.35rem;
  }
}

/* Subtle glass edge highlight along the top */
.banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.12), rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.1));
  pointer-events: none;
  z-index: 1;
}

/* Left section: Avatar + Info */
.banner-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1;
}

.banner-avatar {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--banner-accent, #6366f1);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.banner-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-avatar-text {
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.banner-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  flex: 1;
}

.banner-top-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.banner-view-popover {
  z-index: 50;
  margin-top: 0.5rem;
  min-width: 16rem;
  width: 16rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(139, 92, 246, 0.14);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 45px rgba(41, 28, 84, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: none !important;
  transition: none !important;
  will-change: auto;
  contain: layout paint;
}

.banner-view-popover[data-entering],
.banner-view-popover[data-exiting] {
  animation: none !important;
  transition: none !important;
}

.banner-view-menu {
  padding: 0.45rem;
}

.banner-view-header {
  padding: 0.45rem 0.55rem 0.4rem;
}

.banner-view-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #312455;
}

.banner-view-caption {
  margin-top: 0.2rem;
  font-size: 0.7rem;
  line-height: 1.35;
  color: #6b5b95;
}

.banner-view-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.15rem;
}

.banner-view-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  cursor: pointer;
  border-radius: 0.8rem;
  padding: 0.7rem 0.75rem;
  color: #453370;
  transition: background 0.15s ease, color 0.15s ease;
}

.banner-view-option[data-focused],
.banner-view-option[data-hovered] {
  background: rgba(99, 102, 241, 0.08);
  color: #312455;
}

.banner-view-option[data-selected] {
  background: rgba(99, 102, 241, 0.12);
  color: #2b1f4c;
}

.banner-view-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
  flex-shrink: 0;
}

.banner-view-option-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.banner-view-option-label {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

.banner-view-option-description {
  margin-top: 0.15rem;
  font-size: 0.69rem;
  line-height: 1.35;
  color: #6b5b95;
}

.banner-view-option-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4f46e5;
  flex-shrink: 0;
}

.banner-view-option-check--hidden {
  visibility: hidden;
}

.banner-overflow-popover {
  z-index: 50;
  margin-top: 0.5rem;
  min-width: 17rem;
  max-width: min(20rem, calc(100vw - 1.5rem));
  border-radius: 0.9rem;
  border: 1px solid rgba(139, 92, 246, 0.14);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 45px rgba(41, 28, 84, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.banner-overflow-menu {
  padding: 0.45rem;
}

.banner-overflow-section + .banner-overflow-section {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(99, 102, 241, 0.08);
}

.banner-overflow-heading {
  padding: 0.35rem 0.55rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #312455;
}

.banner-overflow-items {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.15rem;
}

.banner-overflow-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  cursor: pointer;
  border: none;
  border-radius: 0.8rem;
  background: transparent;
  padding: 0.72rem 0.75rem;
  color: #453370;
  text-align: left;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.banner-overflow-item:hover,
.banner-overflow-item:focus-visible {
  background: rgba(99, 102, 241, 0.08);
  color: #312455;
  outline: none;
}

.banner-overflow-item:disabled,
.banner-overflow-item[aria-disabled='true'] {
  cursor: default;
  opacity: 0.6;
}

.banner-overflow-item[aria-disabled='true']:hover,
.banner-overflow-item[aria-disabled='true']:focus-visible {
  background: transparent;
  color: #453370;
}

.banner-overflow-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
  flex-shrink: 0;
}

.banner-overflow-item-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.banner-overflow-item-label {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

.banner-overflow-item-description {
  margin-top: 0.15rem;
  font-size: 0.69rem;
  line-height: 1.35;
  color: #6b5b95;
}

.banner-overflow-item-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4f46e5;
  flex-shrink: 0;
}

.banner-overflow-item-check--hidden {
  visibility: hidden;
}

.banner-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.45);
  color: #4c3a7a;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  position: relative;
}

.banner-settings:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #3b2d6b;
  transform: scale(1.05);
}

.banner-settings:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.4);
  outline-offset: 1px;
}

.banner-settings:active {
  transform: scale(0.95);
}

.banner-settings:disabled,
.banner-settings[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.banner-settings[aria-disabled='true']:hover,
.banner-settings[aria-disabled='true']:focus-visible,
.banner-settings[aria-disabled='true']:active {
  background: rgba(255, 255, 255, 0.45);
  color: #4c3a7a;
  transform: none;
}

.banner-plan {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.75rem;
  padding: 0 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(124, 58, 237, 0.18);
  background: rgba(255, 255, 255, 0.55);
  color: #3b2d6b;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.banner-plan:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(124, 58, 237, 0.28);
  transform: translateY(-1px);
}

.banner-plan:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.4);
  outline-offset: 1px;
}

.banner-plan-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.12);
  color: #4338ca;
  font-size: 0.65rem;
  line-height: 1;
}

.banner-settings--alert {
  color: #92400e;
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.7);
}

.banner-settings--alert:hover {
  background: rgba(245, 158, 11, 0.3);
  border-color: rgba(245, 158, 11, 0.85);
}

.banner-settings-dot {
  position: absolute;
  top: -0.2rem;
  right: -0.15rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 2px #e4dffe;
}

.banner-settings-dot--alert {
  background: #f97316;
  box-shadow: 0 0 0 2px #e4dffe, 0 0 6px rgba(249, 115, 22, 0.6);
}

.banner-desktop-only {
  display: inline-flex;
}

.banner-mobile-only {
  display: none;
}

.banner-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e1145;
  line-height: 1.25;
}

/* Connection badge - glassmorphic */
.banner-connection {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.4rem 0.125rem 0.3rem;
  border-radius: 9999px;
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.banner-connection--connected {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}

.banner-connection--connecting,
.banner-connection--reconnecting {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.banner-connection--offline,
.banner-connection--error {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.banner-connection-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.banner-connection-dot--pulse {
  animation: connection-pulse 1.5s ease-in-out infinite;
}

@keyframes connection-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.banner-connection-label {
  line-height: 1;
}

.banner-connection-check {
  margin-left: -0.0625rem;
  opacity: 0;
  animation: connection-check-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}

@keyframes connection-check-in {
  0% { opacity: 0; transform: scale(0); }
  100% { opacity: 1; transform: scale(1); }
}

@media (max-width: 767px) {
  .banner-connection {
    padding: 0.125rem 0.3rem;
  }

  .banner-connection-label,
  .banner-connection-check {
    display: none;
  }

}

/* Agent contact icons - inline with name */
.banner-contact-icons {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: 0.25rem;
}

.banner-contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: #5b4a8a;
  font-size: 0.75rem;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.banner-contact-link:hover {
  color: #4338ca;
  background: rgba(255, 255, 255, 0.35);
}

.banner-contact-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.banner-contact-link:hover svg {
  opacity: 1;
}

.banner-contact-text {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hide text on smaller screens, show only icons */
@media (max-width: 900px) {
  .banner-contact-text {
    display: none;
  }

  .banner-contact-link {
    padding: 0.25rem;
  }

  .banner-contact-link svg {
    opacity: 1;
  }
}

/* Current task row */
.banner-task {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  opacity: 0;
  transform: translateX(-4px);
}

.banner-task--animate {
  animation: banner-task-in 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes banner-task-in {
  0% { opacity: 0; transform: translateX(-4px); }
  100% { opacity: 1; transform: translateX(0); }
}

.banner-task-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
  opacity: 0.7;
}

.banner-task-dot--active {
  opacity: 1;
  animation: task-dot-pulse 1.2s ease-in-out infinite;
}

@keyframes task-dot-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0);
  }
}

.banner-task-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: #5b4a8a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Right section: Close button */
.banner-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 0.75rem;
  gap: 0.5rem;
  position: relative;
  z-index: 2;
}

.banner-share {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.75rem;
  padding: 0 0.65rem;
  border-radius: 0.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.45);
  color: #4c3a7a;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.banner-share:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #3b2d6b;
  transform: translateY(-1px);
}

.banner-share:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.4);
  outline-offset: 1px;
}

.banner-share:disabled,
.banner-share[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.banner-share[aria-disabled='true']:hover,
.banner-share[aria-disabled='true']:focus-visible {
  background: rgba(255, 255, 255, 0.45);
  color: #4c3a7a;
  transform: none;
}

.banner-share-label {
  line-height: 1;
}

@container agent-chat-banner (max-width: 58rem) {
  .banner-upgrade span,
  .banner-plan-label,
  .banner-share-label {
    display: none;
  }

  .banner-upgrade {
    padding: 0.375rem;
    margin-right: 0.25rem;
  }

  .banner-share {
    width: 1.75rem;
    padding: 0;
    justify-content: center;
  }

  .banner-plan {
    min-width: 1.75rem;
    padding: 0 0.45rem;
    justify-content: center;
  }
}

.banner-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.45);
  color: #4c3a7a;
  cursor: pointer;
  transition: all 0.15s ease;
  isolation: isolate;
}

.banner-close:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #3b2d6b;
  transform: scale(1.05);
}

.banner-close:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.4);
  outline-offset: 1px;
}

.banner-close:active {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0.95);
}

/* Upgrade button */
.banner-upgrade {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  margin-right: 0.5rem;
  border-radius: 0.5rem;
  border: none;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
  overflow: hidden;
}

.banner-upgrade::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );
  animation: banner-upgrade-shimmer 3s ease-in-out infinite;
}

@keyframes banner-upgrade-shimmer {
  0% { left: -100%; }
  50%, 100% { left: 100%; }
}

.banner-upgrade:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

.banner-upgrade:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.4);
  outline-offset: 2px;
}

.banner-upgrade:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}

@media (max-width: 640px) {
  .banner-upgrade span {
    display: none;
  }

  .banner-upgrade {
    padding: 0.375rem;
  }

  .banner-upgrade--text span {
    display: inline;
  }

  .banner-upgrade--text {
    padding: 0.375rem 0.75rem;
  }

  .banner-desktop-only {
    display: none;
  }

  .banner-mobile-only {
    display: inline-flex;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .banner {
    padding: 0.5rem 0.875rem;
    gap: 0.5rem;
  }

  .banner-avatar {
    width: 2rem;
    height: 2rem;
  }

  .banner-avatar-text {
    font-size: 0.6875rem;
  }

  .banner-name {
    font-size: 0.8125rem;
  }

  .banner-task-title {
    max-width: 120px;
  }

  .banner-close {
    width: 1.5rem;
    height: 1.5rem;
  }

  .banner-share {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    justify-content: center;
  }

  .banner-share-label {
    display: none;
  }

  .banner-overflow-popover {
    min-width: min(18rem, calc(100vw - 1rem));
  }

  .banner-plan-label {
    display: none;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .banner,
  .banner-task,
  .banner-connection-check {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .banner-connection-dot--pulse,
  .banner-task-dot--active {
    animation: none;
  }

  .banner-shell {
    transition: none;
  }
}

/* ==========================================================================
   Main Content Area - Container Scrolling Architecture
   ========================================================================== */

/* Main content flex child - fills remaining space after banner */
.agent-chat-main {
  --agent-chat-sidebar-current-width: var(--agent-chat-sidebar-width, 18rem);
  flex: 1;
  min-height: 0; /* Critical for flex child to shrink and enable overflow */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  /* Sidebar offset */
  padding-left: var(--agent-chat-sidebar-current-width);
  transition: padding-left 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 767px) {
  .agent-chat-main {
    padding-left: 0;
  }
}

@media (min-width: 768px) {
  .agent-chat-page--framed .agent-chat-main {
    padding-top: var(--agent-chat-frame-padding, 0.75rem);
    padding-right: var(--agent-chat-frame-padding, 0.75rem);
    padding-bottom: var(--agent-chat-frame-padding, 0.75rem);
    padding-left: calc(var(--agent-chat-sidebar-current-width) + var(--agent-chat-sidebar-frame-gap, 0rem));
    transition: padding-left 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

#agent-workspace-root {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  background: transparent;
}

.agent-chat-workspace-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.agent-chat-timeline-region {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  overflow: hidden;
  position: relative;
}

.agent-chat-plan-frame {
  display: none;
}

.agent-chat-plan-frame > .plan-panel {
  display: flex;
  width: 100%;
}

@media (min-width: 1024px) {
  #agent-workspace-root {
    flex-direction: row;
  }

  .agent-chat-plan-frame {
    --agent-chat-plan-panel-width: min(18.5rem, calc(100vw - 2rem));
    display: flex;
    flex: 0 0 0;
    width: 0;
    max-width: 0;
    max-height: min(
      calc(100vh - var(--agent-chat-banner-height, 4rem) - 1.75rem),
      calc(100% - var(--agent-chat-banner-height, 4rem) - 1.75rem)
    );
    align-self: flex-start;
    margin: calc(var(--agent-chat-banner-height, 4rem) + 0.875rem) 0 0.875rem 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateX(0.5rem);
    transition:
      flex-basis 260ms cubic-bezier(0.22, 1, 0.36, 1),
      width 260ms cubic-bezier(0.22, 1, 0.36, 1),
      max-width 260ms cubic-bezier(0.22, 1, 0.36, 1),
      margin-right 260ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 180ms ease,
      transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .agent-chat-plan-frame > .plan-panel {
    flex: 0 0 var(--agent-chat-plan-panel-width);
    width: var(--agent-chat-plan-panel-width);
  }

  #agent-workspace-root[data-plan-mode='docked'] > .agent-chat-plan-frame {
    flex-basis: var(--agent-chat-plan-panel-width);
    width: var(--agent-chat-plan-panel-width);
    max-width: var(--agent-chat-plan-panel-width);
    margin: calc(var(--agent-chat-banner-height, 4rem) + 0.875rem) 0.875rem 0.875rem 0;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    z-index: 2;
  }

  #agent-workspace-root[data-plan-mode='floating'] > .agent-chat-plan-frame {
    position: absolute;
    top: calc(var(--agent-chat-banner-height, 4rem) + 0.875rem);
    right: 0.875rem;
    flex-basis: auto;
    width: var(--agent-chat-plan-panel-width);
    max-width: var(--agent-chat-plan-panel-width);
    max-height: calc(100vh - var(--agent-chat-banner-height, 4rem) - 1.75rem);
    margin: 0;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
    transform: none;
    z-index: 45;
    cursor: pointer;
  }

  #agent-workspace-root[data-plan-mode='floating'] > .agent-chat-plan-frame > .plan-panel {
    width: var(--agent-chat-plan-panel-width);
    max-height: calc(100vh - var(--agent-chat-banner-height, 4rem) - 1.75rem);
    animation: agent-chat-plan-preview-in 180ms ease-out both;
  }

  #agent-workspace-root[data-plan-mode='floating'] > .agent-chat-plan-frame--exiting > .plan-panel {
    animation: agent-chat-plan-preview-out 160ms ease-in both;
  }
}

@keyframes agent-chat-plan-preview-in {
  from {
    opacity: 0;
    transform: translateY(-0.4rem) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes agent-chat-plan-preview-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-0.25rem) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-chat-plan-frame {
    transition: none;
  }

  #agent-workspace-root[data-plan-mode='floating'] > .agent-chat-plan-frame > .plan-panel {
    animation: none;
  }
}

.plan-panel {
  position: relative;
  flex-direction: column;
  min-height: 0;
  border-radius: 1.05rem;
  border: 1px solid rgba(196, 181, 253, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.022)),
    #685d7e;
  background-clip: border-box;
  color: rgba(255, 255, 255, 0.9);
  clip-path: inset(0 round 1.05rem);
  box-shadow:
    0 16px 42px rgba(24, 16, 48, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.11);
  overflow: hidden;
  isolation: isolate;
}

.plan-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  pointer-events: none;
}

.plan-panel > * {
  position: relative;
  z-index: 1;
}

.plan-panel--compact {
  display: flex;
  border-radius: 1rem;
  max-height: min(72vh, 44rem);
}

.plan-panel-header {
  padding: 1rem 1rem 0.55rem;
}

.plan-panel-header h2 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.48);
}

.plan-panel-task-list {
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
  margin: 0;
  padding: 0 1rem 0.9rem;
  list-style: none;
  overflow: auto;
}

.plan-panel-task {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  align-items: start;
  gap: 0.54rem;
  font-size: 0.83rem;
  line-height: 1.42;
  color: rgba(255, 255, 255, 0.72);
}

.plan-panel-task-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
  color: rgba(255, 255, 255, 0.56);
}

.plan-panel-task[data-status='done'] .plan-panel-task-icon {
  color: rgba(255, 255, 255, 0.62);
}

.plan-panel-task[data-status='doing'] .plan-panel-task-icon {
  color: rgba(255, 255, 255, 0.68);
}

.plan-panel-task[data-status='doing'][data-work-state='active'] .plan-panel-task-icon {
  animation: plan-panel-spin 1s linear infinite;
}

.plan-panel-task[data-status='doing'][data-work-state='paused'] .plan-panel-task-icon {
  color: rgba(255, 255, 255, 0.5);
}

.plan-panel-task[data-status='todo'] .plan-panel-task-icon {
  color: rgba(255, 255, 255, 0.48);
}

.plan-panel-task-title {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.plan-panel-task[data-status='done'] .plan-panel-task-title {
  color: rgba(255, 255, 255, 0.66);
}

.plan-panel-task[data-status='doing'] .plan-panel-task-title {
  color: rgba(255, 255, 255, 0.78);
}

.plan-panel-task[data-status='todo'] .plan-panel-task-title {
  color: rgba(255, 255, 255, 0.58);
}

@keyframes plan-panel-spin {
  to {
    transform: rotate(360deg);
  }
}

.plan-panel-empty {
  margin: 0;
  padding: 0 1rem 0.9rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
}

.plan-panel-deliverables {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  padding: 0.8rem 1rem 1rem;
  border-top: 1px solid rgba(221, 214, 254, 0.14);
}

.plan-panel-deliverables-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.48);
}

.plan-panel-deliverable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-height: 1.6rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  font-weight: 550;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.plan-panel-deliverable--file {
  cursor: default;
}

.plan-panel-deliverable-main {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  align-items: center;
  gap: 0.52rem;
  min-width: 0;
  flex: 1 1 auto;
}

.plan-panel-deliverable-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-panel-deliverable:hover,
.plan-panel-deliverable-download:hover {
  color: rgba(255, 255, 255, 0.96);
}

.plan-panel-deliverable-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  transition: color 0.16s ease, background 0.16s ease;
}

.plan-panel-deliverable-download:hover,
.plan-panel-deliverable-download:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

@media (min-width: 768px) {
  .agent-chat-main[data-sidebar-mode='gallery'] #agent-workspace-root {
    align-self: center;
    width: min(var(--agent-chat-gallery-conversation-width, 25rem), 100%);
    max-width: 100%;
  }

  .agent-chat-page--framed #agent-workspace-root {
    border-radius: var(--agent-chat-frame-radius, 0.875rem);
    background:
      radial-gradient(ellipse 120% 80% at 20% 10%, rgba(139, 92, 246, 0.06) 0%, transparent 60%),
      radial-gradient(ellipse 100% 70% at 85% 20%, rgba(124, 58, 237, 0.05) 0%, transparent 55%),
      radial-gradient(ellipse 140% 100% at 50% 100%, rgba(139, 92, 246, 0.05) 0%, rgba(124, 58, 237, 0.02) 40%, transparent 70%),
      linear-gradient(to bottom, #fbf9ff 0%, #f9f7fe 100%);
    background-clip: padding-box;
  }
}

/* Scrollable timeline container - this is what scrolls, not the body */
#timeline-shell {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-y: contain;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  /* Scroll snap helps with initial positioning */
  scroll-snap-type: y proximity;
  background: transparent;
}

/* Disable scroll-snap when user has scrolled up (not pinned to bottom) */
#timeline-shell[data-scroll-pinned="false"] {
  scroll-snap-type: none;
}

/* Spacer that grows to push content to bottom when there's extra space */
/* Also provides padding for the fixed banner */
#timeline-spacer {
  flex: 1 1 auto;
  min-height: calc(var(--agent-chat-banner-height, 0px) + 0.75rem);
  background: transparent;
}

/* Inner container for max-width constraint - doesn't grow */
#timeline-inner {
  flex: 0 0 auto;
  width: 100%;
  max-width: min(56rem, 100%);
  margin: 0 auto;
  padding: 0 1rem;
  padding-bottom: 0;
  background: transparent;
}

@media (min-width: 640px) {
  #timeline-inner {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  #timeline-inner {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}

:root {
  --composer-height: 6.5rem;
  --working-panel-height: 13rem;
  --working-panel-gap: 0.75rem;
}

#timeline-events {
  --timeline-row-gap: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: var(--timeline-row-gap);
  padding: 0;
  background: transparent;
}

#timeline-event-list,
.streaming-response-slot {
  display: flex;
  flex-direction: column;
  gap: var(--timeline-row-gap);
}

#timeline-events > *,
#timeline-event-list > *,
.streaming-response-slot > * {
  margin: 0;
}

/* Extra padding when jump button is visible */
#timeline-events[data-has-jump-button="true"] {
  padding-bottom: 3rem;
}

/* Ensure content above progress bar isn't cut off */
#timeline-events[data-has-working-panel="true"] {
  scroll-padding-bottom: 1rem;
}

#timeline-events.timeline-align-end {
  justify-content: flex-end;
}

#timeline-shell::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}


/* ==========================================================================
   Composer - Flex child at bottom (container scrolling architecture)
   ========================================================================== */

.composer-shell {
  /* Flex child at bottom of agent-workspace-root */
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 0 1.5rem;
  padding-top: 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
  z-index: 40;
  pointer-events: none;
  background: transparent;
}

.composer-surface {
  width: min(56rem, 100%);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: auto;
}

.composer-send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--composer-accent-text, #ffffff);
  background: linear-gradient(
    145deg,
    var(--composer-accent-light, #818cf8) 0%,
    var(--composer-accent, #6366f1) 50%,
    var(--composer-accent-dark, #4f46e5) 100%
  );
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  border: none;
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(99, 102, 241, 0.2),
    0 4px 16px rgba(79, 70, 229, 0.15);
}

.composer-send-button:hover:not([disabled]) {
  transform: scale(1.05) translateY(-1px);
  box-shadow:
    0 4px 12px rgba(99, 102, 241, 0.3),
    0 8px 24px rgba(79, 70, 229, 0.2);
}

.composer-send-button:active:not([disabled]) {
  transform: scale(0.97);
  box-shadow:
    0 2px 6px rgba(99, 102, 241, 0.2),
    0 4px 12px rgba(79, 70, 229, 0.12);
}

.composer-send-button:focus-visible {
  outline: 3px solid var(--composer-accent-focus, rgba(99, 102, 241, 0.4));
  outline-offset: 2px;
}

.composer-send-button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.composer-send-button--stop {
  animation: composerStopButtonPulse 1.8s ease-in-out infinite;
}

.composer-send-button--stop:hover:not([disabled]) {
  box-shadow:
    0 4px 12px rgba(99, 102, 241, 0.3),
    0 8px 24px rgba(79, 70, 229, 0.2);
}

.composer-send-button--stop:active:not([disabled]) {
  box-shadow:
    0 2px 6px rgba(99, 102, 241, 0.2),
    0 4px 12px rgba(79, 70, 229, 0.12);
}

.composer-send-button--stop-busy {
  animation-duration: 1s;
}

.composer-send-button-stop-icon {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 0.14rem;
  background: currentColor;
  display: inline-block;
  animation: composerStopIconBeat 1.8s ease-in-out infinite;
}

@keyframes composerStopButtonPulse {
  0%, 100% {
    box-shadow:
      0 2px 8px rgba(99, 102, 241, 0.2),
      0 4px 16px rgba(79, 70, 229, 0.15),
      0 0 0 0 rgba(129, 140, 248, 0.18);
  }
  50% {
    box-shadow:
      0 4px 12px rgba(99, 102, 241, 0.28),
      0 8px 20px rgba(79, 70, 229, 0.18),
      0 0 0 8px rgba(129, 140, 248, 0);
  }
}

@keyframes composerStopIconBeat {
  0%, 100% {
    transform: scale(0.94);
    opacity: 0.9;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

.composer-input-surface {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.04);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.composer-input-surface:focus-within {
  border-color: rgba(165, 180, 252, 0.5);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(99, 102, 241, 0.08);
}

.composer-utility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.35rem;
}

.composer-utility-row__leading {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.composer-utility-row__actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-left: auto;
}

.composer-action-trigger {
  display: inline-flex;
  height: 2rem;
  width: 2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 9999px;
  background: rgba(248, 250, 252, 0.96);
  color: #475569;
  transition: all 0.15s ease;
  cursor: pointer;
}

.composer-action-trigger:hover:not(:disabled) {
  border-color: rgba(99, 102, 241, 0.28);
  color: #4f46e5;
  background: rgba(238, 242, 255, 0.96);
}

.composer-action-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.composer-action-popover {
  width: max-content;
  max-width: calc(100vw - 2rem);
  z-index: 60;
}

.composer-action-menu {
  display: inline-flex;
  flex-direction: column;
  width: max-content;
  padding: 0.35rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px -18px rgba(15, 23, 42, 0.28), 0 6px 18px -10px rgba(15, 23, 42, 0.18);
}

.composer-action-item {
  display: flex;
  width: auto;
  min-width: 100%;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: #0f172a;
  padding: 0.7rem 0.8rem;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.composer-action-item:hover:not(:disabled) {
  background: rgba(238, 242, 255, 0.95);
  color: #4338ca;
}

.composer-action-item:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.composer-action-divider {
  height: 1px;
  margin: 0.2rem 0.45rem;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0.28) 50%, rgba(99, 102, 241, 0.08) 100%);
}

.composer-action-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.composer-action-item-label {
  min-width: 0;
}

/* Minimal intelligence selector */
.composer-intelligence {
  display: inline-flex;
  align-items: center;
}

.composer-intelligence-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.composer-intelligence-trigger:hover:not([data-busy="true"]):not(:disabled) {
  color: #6366f1;
}

.composer-intelligence-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.composer-intelligence-icon {
  width: 0.875rem;
  height: 0.875rem;
  color: rgba(99, 102, 241, 0.6);
}

.composer-intelligence-trigger:hover:not([data-busy="true"]):not(:disabled) .composer-intelligence-icon {
  color: #6366f1;
}

.composer-intelligence-trigger-label {
  display: inline;
}

.composer-intelligence-trigger-multiplier {
  display: none;
}

.composer-intelligence-trigger-chevron {
  width: 0.75rem;
  height: 0.75rem;
  color: rgba(148, 163, 184, 0.8);
  transition: transform 0.15s ease;
}

.composer-intelligence-trigger[aria-expanded="true"] .composer-intelligence-trigger-chevron {
  transform: rotate(180deg);
}

.composer-intelligence-trigger:hover:not([data-busy="true"]):not(:disabled) .composer-intelligence-trigger-chevron {
  color: rgba(99, 102, 241, 0.6);
}

.composer-intelligence-popover {
  width: 15rem;
  z-index: 60;
}

.composer-intelligence-menu {
  border-radius: 0.5rem;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.6);
  padding: 0.25rem 0;
  box-shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.12), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
}

.composer-intelligence-header {
  display: none;
}

.composer-intelligence-list {
  display: flex;
  flex-direction: column;
}

.composer-intelligence-option {
  display: grid;
  grid-template-columns: 1.25rem 1fr 2.75rem;
  align-items: center;
  column-gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  transition: background 0.1s ease;
  border: none;
  cursor: pointer;
  outline: none;
}

.composer-intelligence-option:hover,
.composer-intelligence-option[data-focused="true"] {
  background: rgba(99, 102, 241, 0.04);
}

.composer-intelligence-option[data-selected="true"] {
  background: rgba(99, 102, 241, 0.05);
}

.composer-intelligence-option[data-selected="true"] .composer-intelligence-option-label {
  color: #0f172a;
}

.composer-intelligence-option[data-selected="true"] .composer-intelligence-option-multiplier {
  color: #6366f1;
  font-weight: 500;
}

.composer-intelligence-option[data-selected="true"] .composer-intelligence-option-multiplier--locked {
  color: #f97316;
  font-weight: 400;
}

.composer-intelligence-option[data-locked="true"] {
  cursor: pointer;
  opacity: 0.6;
}

.composer-intelligence-option-icon {
  width: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1;
}

.composer-intelligence-option-label {
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-intelligence-option-multiplier {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: rgba(148, 163, 184, 0.9);
  text-align: right;
}

.composer-intelligence-option-multiplier--locked {
  color: #f97316;
}

.composer-intelligence-option-indicator {
  display: none;
}

.composer-intelligence-note {
  margin-top: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.625rem;
  color: rgba(100, 116, 139, 0.7);
}

.composer-intelligence-note-link {
  margin-left: 0.25rem;
  border: 0;
  padding: 0;
  background: transparent;
  color: #6366f1;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.composer-intelligence-note-link:hover {
  color: #4f46e5;
}

.composer-intelligence-error {
  margin-top: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.625rem;
  color: #ef4444;
}

.composer-submit-error {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  flex-wrap: wrap;
  border-radius: 0.625rem;
  border: 1px solid rgba(239, 68, 68, 0.32);
  background: rgba(254, 242, 242, 0.92);
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
  line-height: 1.2rem;
  color: #b91c1c;
}

.composer-submit-error-text {
  flex: 1 1 12rem;
}

.composer-submit-error-upgrade {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(185, 28, 28, 0.3);
  background: rgba(255, 255, 255, 0.88);
  color: #991b1b;
  padding: 0.15rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.1rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.composer-submit-error-upgrade:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(153, 27, 27, 0.42);
}

.composer-submit-error-upgrade:focus-visible {
  outline: 2px solid rgba(185, 28, 28, 0.35);
  outline-offset: 1px;
}

.composer-intelligence-pack {
  margin-top: 0.25rem;
  width: 100%;
  border-radius: 0.5rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.04);
  color: #6366f1;
  font-size: 0.6875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.composer-intelligence-pack:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
}

/* ==========================================================================
   Composer Working Panel (integrated)
   ========================================================================== */

.composer-working-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 1rem 1rem 0 0;
  border: none;
  box-shadow: 0 -4px 20px -8px rgba(99, 102, 241, 0.08);
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.composer-working-panel[data-expanded="false"] .composer-working-content {
  display: none;
}

.composer-working-panel[data-has-pending-actions="true"] {
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.98) 0%, rgba(255, 251, 235, 0.96) 100%);
  box-shadow: 0 -4px 22px -10px rgba(14, 165, 233, 0.22);
}

.composer-working-panel[data-has-pending-actions="true"] .composer-working-header-row {
  background: rgba(255, 255, 255, 0.42);
}

.composer-working-panel[data-has-pending-actions="true"] .composer-working-header-row:hover {
  background: rgba(255, 255, 255, 0.62);
}

.composer-working-panel[data-has-pending-actions="true"] .composer-working-indicator {
  color: #0284c7;
  opacity: 1;
}

.composer-working-panel[data-has-pending-actions="true"] .composer-working-status strong {
  color: #075985;
}

.composer-working-panel[data-has-pending-actions="true"] .composer-working-tasks-badge {
  color: #075985;
  background: rgba(14, 165, 233, 0.13);
}

/* Header row - clickable to toggle expand/collapse */
.composer-working-header-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 1.25rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.composer-working-header-row:hover {
  background: rgba(99, 102, 241, 0.04);
}

/* Legacy - keep for any remaining uses */
.composer-working-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  padding-right: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  text-align: left;
  transition: background-color 0.15s ease;
}

.composer-working-header:hover {
  background: rgba(99, 102, 241, 0.04);
}

.composer-working-indicator {
  width: 0.85rem;
  height: 0.85rem;
  color: #6366f1;
  opacity: 0.88;
  flex-shrink: 0;
}

.composer-working-indicator--dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  color: #0284c7;
}

.composer-working-indicator--dots .composer-working-dot {
  background: currentColor;
}

.composer-working-status {
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.composer-working-status strong {
  color: #334155;
  font-weight: 600;
}

@media (max-width: 480px) {
  .composer-working-header-row {
    padding: 0.25rem 0.75rem;
    gap: 0.5rem;
  }

  .composer-working-status {
    font-size: 0.75rem;
  }

  .composer-working-ellipsis {
    display: none;
  }
}

.composer-working-ellipsis {
  display: inline-flex;
  gap: 0.125rem;
  margin-left: 0.125rem;
}

.composer-working-dot {
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 9999px;
  background: #94a3b8;
  animation: composerDotPulse 1.5s ease-in-out infinite;
}

.composer-working-dot:nth-child(1) { animation-delay: 0s; }
.composer-working-dot:nth-child(2) { animation-delay: 0.15s; }
.composer-working-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes composerDotPulse {
  0%, 60%, 100% { opacity: 0.4; transform: scale(1) translateY(1px); }
  30% { opacity: 1; transform: scale(1.2) translateY(1px); }
}

.composer-working-tasks-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  color: #64748b;
  background: rgba(100, 116, 139, 0.1);
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.composer-skip-planning-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.625rem;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 1px solid rgba(14, 165, 233, 0.24);
  background: rgba(255, 255, 255, 0.58);
  padding: 0 0.625rem;
  color: #0369a1;
  font-size: 0.6875rem;
  font-weight: 650;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.composer-skip-planning-button:hover {
  border-color: rgba(14, 165, 233, 0.42);
  background: rgba(255, 255, 255, 0.78);
  color: #075985;
}

.composer-skip-planning-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.agent-chat-skip-planning-fallback {
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem 1rem;
}

.composer-pending-action-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  margin-left: auto;
}

.composer-pending-action-nav__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(14, 165, 233, 0.22);
  background: rgba(255, 255, 255, 0.58);
  color: #075985;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.composer-pending-action-nav__button:hover {
  border-color: rgba(14, 165, 233, 0.42);
  background: rgba(255, 255, 255, 0.78);
  color: #0c4a6e;
}

.composer-pending-action-nav__button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.composer-pending-action-nav__count {
  min-width: 3rem;
  text-align: center;
  color: #64748b;
  font-size: 0.625rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 767px) {
  .composer-working-tasks-badge {
    display: none;
  }
}

.composer-working-toggle {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  color: #94a3b8;
  transition: color 0.15s ease;
}

.composer-pending-action-nav + .composer-working-toggle,
.composer-insight-tabs + .composer-working-toggle {
  margin-left: 0;
}

.composer-working-header:hover .composer-working-toggle,
.composer-working-header-row:hover .composer-working-toggle {
  color: #64748b;
}

.composer-working-content {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  height: 7.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.composer-working-content::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}

.composer-working-panel[data-has-pending-actions="true"] .composer-working-content {
  height: auto;
  max-height: min(70vh, 32rem);
  overflow-y: auto;
}

.composer-working-pending-actions {
  width: 100%;
  animation: composerInsightFadeIn 0.25s ease-out;
}

.composer-working-pending-actions > section {
  background: transparent;
  padding: 0.75rem 1rem 1rem;
}

.composer-working-label {
  display: none;
}

.composer-working-insight {
  display: flex;
  align-items: stretch;
  overflow: visible;
  min-height: 7.5rem;
  height: 7.5rem;
  animation: composerInsightFadeIn 0.25s ease-out;
}

.composer-working-insight .insight-card-v2 {
  width: 100%;
  height: 100%;
}

.composer-working-insight[data-loading="true"] {
  background: linear-gradient(135deg, #e0f2fe 0%, #eef2ff 45%, #ffffff 100%);
}

.composer-working-insight-skeleton {
  width: 100%;
  height: 100%;
  padding: 1rem 1.25rem;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.625rem;
}

.composer-working-insight-skeleton span {
  display: block;
  border-radius: 9999px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.12), rgba(14, 165, 233, 0.22), rgba(99, 102, 241, 0.12));
  background-size: 180% 100%;
  animation: composerInsightSkeleton 1.2s ease-in-out infinite;
}

.composer-working-insight-skeleton__eyebrow {
  width: 4.25rem;
  height: 0.5rem;
}

.composer-working-insight-skeleton__title {
  width: min(18rem, 72%);
  height: 0.875rem;
}

.composer-working-insight-skeleton__line {
  width: min(24rem, 88%);
  height: 0.625rem;
}

.composer-working-insight-skeleton__line--short {
  width: min(16rem, 58%);
}

@keyframes composerInsightSkeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@media (max-width: 700px) {
  .composer-working-content {
    height: 8rem;
  }
  .composer-working-insight {
    min-height: 8rem;
    height: 8rem;
  }

  .composer-working-panel[data-has-pending-actions="true"] .composer-working-content {
    height: auto;
    max-height: min(72vh, 30rem);
  }
}

@media (max-width: 480px) {
  .composer-working-content {
    height: 7rem;
  }
  .composer-working-insight {
    min-height: 7rem;
    height: 7rem;
  }

  .composer-working-panel[data-has-pending-actions="true"] .composer-working-content {
    height: auto;
    max-height: min(74vh, 28rem);
  }

  .composer-working-pending-actions > section {
    padding: 0.625rem 0.75rem 0.875rem;
  }
}

@keyframes composerInsightFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* v2 insight card in composer - transparent bg, wrapper gets gradient */
.composer-working-insight .insight-card-v2 {
  background: transparent;
  border-radius: 0;
}

.composer-working-insight .insight-dismiss-v2 {
  display: none;
}

/* Apply gradients to wrapper based on card type */
.composer-working-insight:has(.insight-card-v2--time-saved) {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #a7f3d0 100%);
}

.composer-working-insight:has(.insight-card-v2--burn-rate) {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #ddd6fe 100%);
}

.composer-working-insight:has(.insight-card-v2--burn-rate-warning) {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 50%, #fde68a 100%);
}

.composer-working-insight:has(.insight-card-v2--burn-rate-critical) {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 50%, #fecaca 100%);
}

.composer-working-insight:has(.insight-card-v2--agent-setup) {
  background: linear-gradient(135deg, #e0f2fe 0%, #eef2ff 45%, #ffffff 100%);
}

/* Colored pill tabs for composer insights - in header row */
.composer-insight-tabs {
  flex-shrink: 1;
  min-width: 0;
  margin-left: auto;
}

.composer-insight-tabs-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px;
}

.composer-insight-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.composer-insight-tabs--loading {
  pointer-events: none;
}

.composer-insight-tab-placeholder {
  display: block;
  flex-shrink: 0;
  width: 3.75rem;
  height: 22px;
  border-radius: 11px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.16), rgba(99, 102, 241, 0.24), rgba(14, 165, 233, 0.16));
  background-size: 180% 100%;
  animation: composerInsightSkeleton 1.2s ease-in-out infinite;
}

.composer-insight-tab-placeholder--active {
  width: 4.5rem;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.24), rgba(99, 102, 241, 0.34), rgba(14, 165, 233, 0.24));
  background-size: 180% 100%;
}

.composer-insight-tab-placeholder--short {
  width: 3rem;
}

.composer-insight-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  border: none;
  border-radius: 11px;
  background: color-mix(in srgb, var(--tab-color, #6b7280) 15%, transparent);
  cursor: pointer;
  padding: 0 10px;
  overflow: hidden;
  flex-shrink: 0;
  transition: background 150ms ease;
}

.composer-insight-tab:hover {
  background: color-mix(in srgb, var(--tab-color, #6b7280) 25%, transparent);
}

.composer-insight-tab[data-active="true"] {
  background: var(--tab-color, #6b7280);
}

.composer-insight-tab[data-active="true"]:hover {
  background: var(--tab-color, #6b7280);
}

.composer-insight-tab-inner {
  display: none;
}

.composer-insight-tab-label {
  position: relative;
  z-index: 1;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--tab-color, #6b7280);
  line-height: 1;
  transition: color 150ms ease;
}

.composer-insight-tab[data-active="true"] .composer-insight-tab-label {
  color: white;
  font-weight: 600;
}

/* Countdown progress indicator */
.composer-insight-tab-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--tab-progress, 0%);
  background: rgba(255, 255, 255, 0.25);
  border-radius: 11px;
  pointer-events: none;
  transition: width 100ms linear;
}

/* Connect working panel to input surface */
.composer-shell[data-panel-visible="true"] .composer-surface > form > .composer-input-surface {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* ==========================================================================
   Drop Overlay
   ========================================================================== */

.agent-chat-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, rgba(99, 102, 241, 0.15), rgba(124, 58, 237, 0.06) 50%, transparent 80%);
  backdrop-filter: blur(4px);
  animation: dropOverlayFadeIn 180ms ease;
}

@keyframes dropOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.agent-chat-drop-overlay__panel {
  padding: 1rem 1.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  color: #e0e7ff;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow:
    0 4px 16px rgba(99, 102, 241, 0.2),
    0 12px 40px rgba(15, 23, 42, 0.25);
}

/* ==========================================================================
   Jump to Latest Button - Fixed at bottom of viewport
   ========================================================================== */

.jump-to-latest {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--composer-height, 6.5rem) + 1rem);
  z-index: 50;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.04);
  transform: translateX(-50%);
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Offset for sidebar */
.has-sidebar .jump-to-latest,
.has-sidebar--collapsed .jump-to-latest,
.agent-chat-main .jump-to-latest {
  left: calc(50% + (var(--agent-chat-sidebar-current-width, var(--agent-chat-sidebar-width, 18rem)) / 2));
}

@media (max-width: 767px) {
  .agent-chat-main .jump-to-latest,
  .has-sidebar .jump-to-latest,
  .has-sidebar--collapsed .jump-to-latest {
    left: 50%;
  }
}

.jump-to-latest[data-visible='false'] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 16px) scale(0.9);
}

.jump-to-latest svg {
  width: 1rem;
  height: 1rem;
  stroke-width: 2;
}

.jump-to-latest:hover {
  border-color: rgba(165, 180, 252, 0.5);
  background: rgba(255, 255, 255, 0.95);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1), 0 12px 32px rgba(99, 102, 241, 0.08);
}

.jump-to-latest:active {
  transform: translateX(-50%) scale(0.96);
}

.jump-to-latest:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.4);
  outline-offset: 2px;
}

.jump-to-latest[data-has-activity="true"]::after {
  content: '';
  position: absolute;
  top: -0.25rem;
  right: -0.2rem;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #f43f5e 0%, #ef4444 100%);
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.4);
  animation: activityPulse 2s ease-in-out infinite;
}

@keyframes activityPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

/* ==========================================================================
   Timeline Load Controls
   ========================================================================== */

.timeline-load-control {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
  min-height: 2.75rem;
  text-transform: none;
  font-size: 0.75rem;
  color: #64748b;
}

.timeline-load-control[hidden] {
  display: none;
}

.timeline-bottom-sentinel {
  width: 100%;
  height: 1px;
  scroll-snap-align: end;
}

.timeline-load-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  color: #4f46e5;
  padding: 0.5rem 1.25rem;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 4px 12px rgba(99, 102, 241, 0.08);
  transition: all 0.2s ease;
  cursor: pointer;
}

.timeline-load-button:hover,
.timeline-load-button:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.06), 0 8px 20px rgba(99, 102, 241, 0.12);
  outline: none;
}

.timeline-load-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), 0 8px 20px rgba(99, 102, 241, 0.12);
}

.timeline-load-button[hidden] {
  display: none;
}

.timeline-load-indicator {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 9999px;
  background: currentColor;
  opacity: 0.65;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.06);
}

.timeline-load-indicator[data-loading='true'] {
  animation: timelineLoadPulse 0.9s linear infinite;
}

@keyframes timelineLoadPulse {
  0% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 0.9; transform: scale(1.05); }
  100% { opacity: 0.3; transform: scale(0.85); }
}

.timeline-load-label {
  font-weight: 600;
  letter-spacing: 0.015em;
}

/* Timeline stack spacing is controlled by --timeline-row-gap. */

#timeline-load-newer[hidden] {
  display: none !important;
  margin: 0;
  padding: 0;
  border: 0;
}

.timeline-history-label {
  font-size: 0.75rem;
  color: #94a3b8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ==========================================================================
   Chat Events & Bubbles - Canvas objects
   ========================================================================== */

.chat-event {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
}

.timeline-event {
  position: relative;
  contain: layout style;
  scroll-margin-bottom: 1rem;
}

.hard-limit-callout {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1.2rem;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.9), rgba(255, 237, 213, 0.9));
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #7c2d12;
}

.hard-limit-callout--critical {
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.95), rgba(254, 202, 202, 0.9));
  border-color: rgba(225, 29, 72, 0.4);
  color: #7f1d1d;
}

.hard-limit-callout--critical .hard-limit-callout-dismiss {
  color: #b91c1c;
}

.hard-limit-callout--critical .hard-limit-callout-dismiss:hover {
  background: rgba(248, 113, 113, 0.2);
}

.hard-limit-callout--critical .hard-limit-callout-dismiss:focus-visible {
  outline: 2px solid rgba(248, 113, 113, 0.55);
}

.hard-limit-callout--critical .hard-limit-callout-icon {
  background: rgba(248, 113, 113, 0.2);
  color: #be123c;
}

.hard-limit-callout--critical .hard-limit-callout-title {
  color: #7f1d1d;
}

.hard-limit-callout--critical .hard-limit-callout-subtitle {
  color: #991b1b;
}

.hard-limit-callout-dismiss {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #92400e;
  cursor: pointer;
  padding: 0.15rem;
  border-radius: 0.5rem;
}

.hard-limit-callout-dismiss:hover {
  background: rgba(251, 191, 36, 0.25);
}

.hard-limit-callout-dismiss:focus-visible {
  outline: 2px solid rgba(251, 191, 36, 0.6);
  outline-offset: 2px;
}

.hard-limit-callout-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hard-limit-callout-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.3);
  color: #b45309;
}

.hard-limit-callout-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #7c2d12;
}

.hard-limit-callout-subtitle {
  font-size: 0.82rem;
  color: #92400e;
  margin-top: 0.1rem;
}

.hard-limit-callout-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hard-limit-callout-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hard-limit-callout-button--secondary {
  background: linear-gradient(135deg, #0f766e 0%, #0f766e 30%, #0369a1 100%);
}

.hard-limit-callout-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.hard-limit-callout-button:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.4);
  outline-offset: 2px;
}

.hard-limit-callout-button:active {
  transform: scale(0.98);
}

.hard-limit-callout-button:disabled {
  cursor: not-allowed;
  opacity: 0.75;
  transform: none;
  box-shadow: none;
}


.hard-limit-callout-upsell {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #7c2d12;
}

.hard-limit-callout-upsell a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  color: #1d4ed8;
  text-decoration: none;
}

.hard-limit-callout-upsell a:hover {
  text-decoration: underline;
}

.scheduled-resume-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(99, 102, 241, 0.18);
  background:
    linear-gradient(135deg, rgba(238, 242, 255, 0.95), rgba(224, 231, 255, 0.7) 50%, rgba(237, 233, 254, 0.6));
  box-shadow:
    0 1px 3px rgba(99, 102, 241, 0.08),
    0 0 0 1px rgba(99, 102, 241, 0.04);
  color: #1e1b4b;
  overflow: hidden;
}

.scheduled-resume-card__spark {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(129, 140, 248, 0.07) 40%,
    rgba(167, 139, 250, 0.1) 60%,
    transparent 100%
  );
  animation: scheduledResumeShimmer 4s ease-in-out infinite;
  pointer-events: none;
}

.scheduled-resume-card__icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  color: #6366f1;
  background: rgba(238, 242, 255, 0.9);
  border: 1px solid rgba(99, 102, 241, 0.15);
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.1);
}

.scheduled-resume-card__content {
  min-width: 0;
}

.scheduled-resume-card__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #312e81;
  letter-spacing: -0.01em;
}

.scheduled-resume-card__time {
  display: inline-flex;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: #6366f1;
  font-weight: 500;
}

.scheduled-resume-card__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: 1px solid rgba(99, 102, 241, 0.15);
  background: rgba(238, 242, 255, 0.85);
  color: #4f46e5;
  padding: 0.3rem 0.65rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.scheduled-resume-card__actions {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.scheduled-resume-card__action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(79, 70, 229, 0.2);
  background: rgba(255, 255, 255, 0.8);
  color: #3730a3;
  padding: 0.38rem 0.8rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.scheduled-resume-card__action--primary {
  border: 1px solid transparent;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: #ffffff;
}

.scheduled-resume-card__action:hover {
  transform: translateY(-1px);
  background: rgba(238, 242, 255, 0.95);
}

.scheduled-resume-card__action--primary:hover {
  background: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%);
}

.scheduled-resume-card__action:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.45);
  outline-offset: 2px;
}

.scheduled-resume-card__action:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

@media (max-width: 640px) {
  .scheduled-resume-card {
    grid-template-columns: auto 1fr;
  }

  .scheduled-resume-card__pill {
    grid-column: 1 / -1;
    justify-self: flex-start;
  }
}

@keyframes scheduledResumeShimmer {
  0%, 100% { opacity: 0; transform: translateX(-100%); }
  40%, 60% { opacity: 1; transform: translateX(0%); }
}

.starter-prompts-card {
  display: flex;
  flex-direction: column;
  border-radius: 0.85rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(238, 242, 255, 0.94));
  color: #1e1b4b;
  overflow: hidden;
}

.starter-prompts-card__title {
  margin: 0;
  padding: 0.6rem 0.85rem 0.42rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #3730a3;
}

.starter-prompts-card__rows {
  display: flex;
  flex-direction: column;
}

.starter-prompts-card__row {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  border-top: 1px solid rgba(99, 102, 241, 0.16);
  background: transparent;
  padding: 0.5rem 0.78rem;
  color: #312e81;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.starter-prompts-card__row:hover:not(:disabled) {
  background: rgba(224, 231, 255, 0.38);
  color: #1e1b4b;
}

.starter-prompts-card__row:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.45);
  outline-offset: -2px;
}

.starter-prompts-card__row:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.starter-prompts-card__row--loading {
  cursor: default;
}

.starter-prompts-card__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.42rem;
  height: 1.42rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(99, 102, 241, 0.24);
  background: rgba(255, 255, 255, 0.92);
  color: #4f46e5;
}

.starter-prompts-card__icon-wrap--loading {
  border-color: rgba(99, 102, 241, 0.16);
  background: rgba(255, 255, 255, 0.72);
}

.starter-prompts-card__icon {
  width: 0.78rem;
  height: 0.78rem;
}

.starter-prompts-card__pulse-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #6366f1;
  animation: starterPromptPulse 1.1s ease-in-out infinite;
}

.starter-prompts-card__text {
  font-size: 0.76rem;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.starter-prompts-card__text--loading {
  display: flex;
  align-items: center;
}

.starter-prompts-card__text-pulse {
  display: block;
  width: 72%;
  height: 0.53rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.28);
  animation: starterPromptPulse 1.1s ease-in-out infinite;
}

.starter-prompts-card__text-pulse--1 {
  width: 66%;
}

.starter-prompts-card__text-pulse--2 {
  width: 79%;
}

.starter-prompts-card__chevron {
  width: 0.88rem;
  height: 0.88rem;
  color: #6366f1;
}

.starter-prompts-card__chevron--loading {
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.22);
  color: transparent;
  animation: starterPromptPulse 1.1s ease-in-out infinite;
}

@keyframes starterPromptPulse {
  0%, 100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.95;
  }
}

.timeline-event--incoming {
  animation: timelineEventIncoming 350ms cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes timelineEventIncoming {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-event--incoming {
    animation-duration: 1ms;
    animation-iteration-count: 1;
    animation-timing-function: linear;
  }

  .scheduled-resume-card__spark {
    animation: none;
    opacity: 0;
  }
}

.chat-event.is-user {
  align-items: flex-end;
}

.chat-event.is-agent {
  align-items: flex-start;
}

/* Chat bubble - Canvas object style */
.chat-bubble {
  max-width: 100%;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 4px 12px rgba(15, 23, 42, 0.03);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.chat-bubble:hover {
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04), 0 8px 20px rgba(15, 23, 42, 0.04);
}

.chat-event[data-status='sending'] .chat-bubble {
  opacity: 0.85;
}

.chat-event[data-status='sending'] .chat-timestamp {
  color: rgba(129, 140, 248, 0.9);
  opacity: 1;
}

.chat-event[data-status='failed'] .chat-bubble {
  border-color: rgba(244, 63, 94, 0.35);
}

.chat-event[data-status='failed'] .chat-timestamp {
  color: rgba(244, 63, 94, 0.85);
  opacity: 1;
}

.chat-content {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Table styling */
.chat-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.875rem;
}

.chat-content th,
.chat-content td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.chat-content th {
  font-weight: 600;
  color: #1e293b;
  background: rgba(248, 250, 252, 0.6);
  border-bottom: 2px solid rgba(99, 102, 241, 0.15);
}

.chat-content tr:hover {
  background: rgba(248, 250, 252, 0.4);
}

.chat-content td a {
  color: #4338ca;
  text-decoration: none;
}

.chat-content td a:hover {
  text-decoration: underline;
}

.chat-bubble--user .chat-content {
  color: #334155;
}

/* User messages - subtle accent, right-aligned */
.chat-bubble--user {
  --user-author-color: #6366f1;
  --user-content-color: #334155;
  --user-meta-color: #94a3b8;
  --user-attachment-bg: #eef2ff;
  --user-attachment-hover-bg: #e0e7ff;
  --user-attachment-color: #4338ca;
  --user-channel-badge-bg: #eef2ff;
  --user-channel-badge-border: #c7d2fe;
  --user-channel-badge-text: #6366f1;
  max-width: 85%;
  background: rgba(245, 247, 255, 0.9);
  color: #1e293b;
  border-color: rgba(199, 210, 254, 0.5);
}

/* Agent messages */
.chat-bubble--agent {
  background: rgba(255, 255, 255, 0.9);
  color: #1e293b;
  border-color: rgba(255, 255, 255, 0.7);
}

/* Peer messages */
.chat-bubble--peer-out {
  background: rgba(250, 245, 255, 0.9);
  color: #1e293b;
  border-color: rgba(233, 213, 255, 0.5);
}

.chat-bubble--peer-in {
  background: rgba(250, 250, 250, 0.9);
  color: #1e293b;
  border: 1px dashed rgba(212, 212, 216, 0.6);
}

/* Chat author styling */
.chat-author {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  margin-bottom: 0.375rem;
  opacity: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-author--user {
  color: #6366f1;
}

.chat-author--agent {
  color: #475569;
}

.chat-author-avatar {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.chat-author-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-author-avatar-text {
  color: white;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.chat-author--peer {
  color: #7c3aed;
  letter-spacing: 0.02em;
}

.user-channel-badge {
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.82);
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* Chat timestamp (inline in header) */
.chat-timestamp {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #94a3b8;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.chat-bubble:hover .chat-timestamp {
  opacity: 1;
}

.chat-author--user .chat-timestamp {
  color: currentColor;
  opacity: 0.5;
}

.chat-author--user:hover .chat-timestamp,
.chat-bubble:hover .chat-author--user .chat-timestamp {
  opacity: 0.7;
}

.chat-author--peer .chat-timestamp {
  color: #a78bfa;
  opacity: 0.6;
}

/* Chat attachments */
.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chat-attachments a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 0.5rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(248, 250, 252, 0.7);
  color: #475569;
}

.chat-attachment-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border: 1px dashed rgba(99, 102, 241, 0.3);
  color: rgba(79, 70, 229, 0.8);
  background: rgba(99, 102, 241, 0.06);
}

.chat-attachments a:hover {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(99, 102, 241, 0.2);
  color: #6366f1;
  transform: translateY(-1px);
}

/* Mobile chat adjustments */
@media (max-width: 768px) {
  .composer-shell {
    padding: 0 0.75rem;
    padding-top: 0;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
  }

  #timeline-inner {
    padding: 0 0.5rem;
    padding-bottom: 0;
  }

  #timeline-events[data-has-jump-button="true"] {
    padding-bottom: calc(var(--timeline-bottom-spacing) + 3rem);
  }

  .jump-to-latest {
    width: 2.25rem;
    height: 2.25rem;
  }

  .composer-input-surface textarea {
    font-size: 16px;
  }

  .composer-utility-row {
    gap: 0.5rem;
  }

  .composer-utility-row__actions {
    gap: 0.35rem;
  }

  .composer-action-popover {
    width: max-content;
    max-width: calc(100vw - 2rem);
  }

  .chat-bubble {
    max-width: 100%;
    font-size: 0.9375rem;
    padding: 0.875rem 1rem;
    border-radius: 0.875rem;
  }

  .chat-author {
    font-size: 0.6875rem;
  }

  .banner {
    padding: 0.5rem 0.875rem;
  }
}

/* ==========================================================================
   Tool Cluster - Floating tool cards
   ========================================================================== */

.tool-cluster {
  background: transparent;
  border: none;
  box-shadow: none;
}

.tool-cluster-shell {
  display: flex;
  flex-direction: column;
  gap: var(--timeline-row-gap);
}

.tool-cluster-summary {
  display: flex;
  width: 100%;
}

.tool-cluster-live-preview {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  text-align: left;
  position: relative;
  overflow: visible;
  isolation: auto;
  border: 0;
  background: transparent;
  color: #082f49;
  padding: 0;
  cursor: default;
  box-shadow: none;
  transition: none;
}

.tool-cluster-live-preview[data-pulse="start"] {
  border-color: rgba(14, 116, 144, 0.44);
}

.tool-cluster-live-preview[data-pulse="finish"] {
  border-color: rgba(37, 99, 235, 0.52);
}

.tool-cluster-live-preview:hover,
.tool-cluster-live-preview:focus-within {
  border-color: transparent;
  background: transparent;
  transform: none;
  outline: none;
}

.tool-cluster-live-preview__pulse {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
}

.tool-cluster-live-preview__pulse[data-pulse="start"] {
  background: linear-gradient(120deg, rgba(14, 165, 233, 0.18), rgba(16, 185, 129, 0.1));
  animation: tool-cluster-live-pulse-start 0.9s ease-out;
}

.tool-cluster-live-preview__pulse[data-pulse="finish"] {
  background: linear-gradient(120deg, rgba(37, 99, 235, 0.2), rgba(125, 211, 252, 0.12));
  animation: tool-cluster-live-pulse-finish 1.1s ease-out;
}

.tool-cluster-live-preview__finish-badge {
  position: absolute;
  top: 0.52rem;
  right: 2.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: rgba(219, 234, 254, 0.95);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.28);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
  z-index: 2;
}

.tool-cluster-live-preview__header,
.tool-cluster-live-preview__headline,
.tool-cluster-live-preview__window {
  position: relative;
  z-index: 1;
}

.tool-cluster-live-preview__header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.38rem;
}

.tool-cluster-live-preview__overview-trigger {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.tool-cluster-live-preview__overview-trigger:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 3px;
  border-radius: 0.7rem;
}

.tool-cluster-live-preview__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  border: 1px solid rgba(14, 116, 144, 0.3);
  background: rgba(207, 250, 254, 0.72);
  color: #0f766e;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tool-cluster-live-preview__badge[data-state="complete"] {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(219, 234, 254, 0.66);
  color: #1e3a8a;
}

.tool-cluster-live-preview__badge-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: currentColor;
  animation: tool-cluster-live-dot-pulse 1.2s ease-in-out infinite;
}

.tool-cluster-live-preview[data-state="complete"] .tool-cluster-live-preview__badge-dot {
  animation-duration: 1.8s;
}

.tool-cluster-live-preview__meta {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.tool-cluster-live-preview__count {
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: inherit;
}

.tool-cluster-live-preview__updated {
  font-size: 0.66rem;
  color: rgba(8, 47, 73, 0.75);
}

.tool-cluster-live-preview__expand {
  display: grid;
  place-items: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(14, 116, 144, 0.25);
  background: rgba(240, 253, 250, 0.72);
  color: #0f766e;
}

.tool-cluster-live-preview__headline {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.28;
  color: rgba(8, 47, 73, 0.95);
}

.tool-cluster-live-preview__feed {
  display: grid;
  gap: 0.75rem;
}

.tool-cluster-live-preview__entry {
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.38rem;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.72);
  padding: 0.3rem 0.38rem;
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
  cursor: pointer;
}

.tool-cluster-live-preview__entry-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.38rem;
  min-width: 0;
}

.tool-cluster-live-preview__entry[data-has-results="true"],
.tool-cluster-live-preview__entry[data-has-tools="true"] {
  grid-template-columns: minmax(0, 1fr);
}

.tool-cluster-live-preview__entry[data-has-results="true"] .tool-cluster-live-preview__entry-header {
  padding: 0.38rem 0.56rem 0;
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.7) 0%, rgba(248, 250, 255, 0.25) 100%);
  border-radius: 0.58rem 0.58rem 0 0;
}

.tool-cluster-live-preview__entry:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.4);
  outline-offset: 1px;
}

.tool-cluster-live-preview__entry[data-new="true"] {
  animation: tool-cluster-live-new-entry 0.8s ease-out;
}

.tool-cluster-live-preview__entry[data-active="true"] {
  border-color: rgba(14, 116, 144, 0.32);
  background: rgba(224, 242, 254, 0.88);
  animation: tool-cluster-live-row-pulse 1.6s ease-in-out infinite;
}

.tool-cluster-live-preview__entry[data-kind="linkedin"][data-active="true"] {
  border-color: transparent;
  background: rgba(240, 249, 255, 0.86);
}

.tool-cluster-live-preview__entry[data-profile-card="true"] {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.74);
  padding: 0.34rem 0.42rem;
}

.tool-cluster-live-preview__entry[data-profile-card="true"] .tool-cluster-live-preview__entry-label {
  font-size: 0.68rem;
  letter-spacing: -0.01em;
}

.tool-cluster-live-preview__entry[data-kind="search"] {
  border-color: rgba(59, 130, 246, 0.10);
}

.tool-cluster-live-preview__entry[data-kind="search"][data-has-results="true"] {
  padding: 0;
  border-color: rgba(59, 130, 246, 0.13);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0.62rem;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.04), 0 0 0 0.5px rgba(37, 99, 235, 0.06);
}

.tool-cluster-live-preview__entry[data-kind="search"][data-active="true"] {
  border-color: rgba(37, 99, 235, 0.26);
}

.tool-cluster-live-preview__entry[data-kind="search"][data-active="true"][data-has-results="true"] {
  border-color: rgba(37, 99, 235, 0.2);
  background: rgba(250, 251, 255, 0.97);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.06), 0 0 0 0.5px rgba(37, 99, 235, 0.1);
}

.tool-cluster-live-preview__entry[data-kind="search"][data-active="true"][data-has-results="true"] .tool-cluster-live-preview__entry-header {
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.55) 0%, rgba(239, 246, 255, 0.2) 100%);
}

.tool-cluster-live-preview__entry[data-has-tools="true"] {
  padding: 0;
  border-color: rgba(16, 185, 129, 0.12);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0.62rem;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.04), 0 0 0 0.5px rgba(16, 185, 129, 0.06);
}

.tool-cluster-live-preview__entry[data-has-tools="true"] .tool-cluster-live-preview__entry-header {
  padding: 0.38rem 0.56rem 0;
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.7) 0%, rgba(248, 255, 252, 0.2) 100%);
  border-radius: 0.58rem 0.58rem 0 0;
}

.tool-cluster-live-preview__entry[data-has-tools="true"] .tool-cluster-live-preview__entry-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.012em;
}

.tool-cluster-live-preview__entry[data-has-tools="true"] .tool-cluster-live-preview__entry-label-row {
  gap: 0.32rem;
}

.tool-cluster-live-preview__entry[data-has-tools="true"] .tool-cluster-live-preview__entry-count {
  font-size: 0.54rem;
  font-weight: 550;
  color: #059669;
  background: rgba(16, 185, 129, 0.08);
  padding: 0.1rem 0.36rem;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.tool-cluster-live-preview__entry[data-has-tools="true"] .tool-cluster-live-preview__entry-separator {
  display: none;
}

.tool-cluster-live-preview__entry[data-active="true"][data-has-tools="true"] {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(250, 255, 253, 0.97);
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.06), 0 0 0 0.5px rgba(16, 185, 129, 0.1);
}

.tool-cluster-live-preview__entry[data-active="true"][data-has-tools="true"] .tool-cluster-live-preview__entry-header {
  background: linear-gradient(180deg, rgba(209, 250, 229, 0.5) 0%, rgba(236, 253, 245, 0.15) 100%);
}

.tool-cluster-live-preview__search-sweep {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(102deg, rgba(14, 165, 233, 0), rgba(14, 165, 233, 0.16), rgba(14, 165, 233, 0));
  z-index: 0;
}

.tool-cluster-live-preview__entry-icon {
  display: grid;
  place-items: center;
  width: 1.34rem;
  height: 1.34rem;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.tool-cluster-live-preview__entry-icon--inline {
  width: 1.18rem;
  height: 1.18rem;
  border-radius: 0.38rem;
}

.tool-cluster-live-preview__entry-icon--inline svg {
  width: 0.68rem;
  height: 0.68rem;
}

.tool-cluster-live-preview__profile-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.72rem;
  height: 1.72rem;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(14, 116, 144, 0.28);
  background: linear-gradient(140deg, rgba(224, 242, 254, 0.95), rgba(186, 230, 253, 0.9));
  color: #0f4c81;
  flex-shrink: 0;
}

.tool-cluster-live-preview__profile-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tool-cluster-live-preview__profile-avatar-fallback {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tool-cluster-live-preview__profile-live-dot {
  position: absolute;
  right: 0.06rem;
  bottom: 0.06rem;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: #14b8a6;
}

.tool-cluster-live-preview__entry-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.03rem;
  position: relative;
  z-index: 1;
}

.tool-cluster-live-preview__entry-label-row {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-width: 0;
  flex-wrap: wrap;
}

.tool-cluster-live-preview__entry-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #0f172a;
}

.tool-cluster-live-preview__entry[data-has-results="true"] .tool-cluster-live-preview__entry-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: #0f172a;
}

.tool-cluster-live-preview__entry[data-has-results="true"] .tool-cluster-live-preview__entry-label-row {
  gap: 0.32rem;
}

.tool-cluster-live-preview__entry-count {
  color: #64748b;
  font-weight: 500;
  font-size: 0.6rem;
}

.tool-cluster-live-preview__entry[data-has-results="true"] .tool-cluster-live-preview__entry-count {
  font-size: 0.54rem;
  font-weight: 550;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  padding: 0.1rem 0.36rem;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.tool-cluster-live-preview__entry[data-has-results="true"] .tool-cluster-live-preview__entry-separator {
  display: none;
}

.tool-cluster-live-preview__entry-separator {
  color: #cbd5e1;
  font-weight: 400;
  font-size: 0.6rem;
  margin: 0 0.02rem;
}

.tool-cluster-live-preview__entry-caption {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  font-size: 0.6rem;
  color: #0f4c81;
  line-height: 1.28;
}

.tool-cluster-live-preview__entry-context {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  font-size: 0.58rem;
  color: rgba(15, 23, 42, 0.72);
  line-height: 1.26;
}

.tool-cluster-live-preview__scrape-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  min-width: 0;
}

.tool-cluster-live-preview__scrape-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  padding: 0.12rem 0.32rem 0.12rem 0.2rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(241, 245, 249, 0.7);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  min-width: 0;
}

.tool-cluster-live-preview__scrape-inline-link:hover {
  background: rgba(224, 231, 239, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.tool-cluster-live-preview__scrape-inline-favicon {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 0.18rem;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.tool-cluster-live-preview__scrape-inline-host {
  font-size: 0.6rem;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tool-cluster-live-preview__scrape-inline-ext {
  width: 0.58rem;
  height: 0.58rem;
  color: rgba(148, 163, 184, 0.6);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.tool-cluster-live-preview__scrape-inline-link:hover .tool-cluster-live-preview__scrape-inline-ext {
  color: rgba(37, 99, 235, 0.55);
}

.tool-cluster-live-preview__scrape-inline-more {
  font-size: 0.56rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
}

.tool-cluster-live-preview__enabled-tools-section {
  grid-column: 1 / -1;
  padding: 0 0.48rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.tool-cluster-live-preview__enabled-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr));
  gap: 0.3rem;
}

.tool-cluster-live-preview__enabled-tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.42rem 0.24rem 0.3rem;
  border-radius: 0.48rem;
  border: 1px solid rgba(16, 185, 129, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(236, 253, 245, 0.3) 100%);
  cursor: default;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.tool-cluster-live-preview__enabled-tool-card:hover {
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.18);
}

.tool-cluster-live-preview__enabled-tool-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 0.4rem;
  flex-shrink: 0;
}

.tool-cluster-live-preview__enabled-tool-card-icon svg {
  width: 0.88rem;
  height: 0.88rem;
}

.tool-cluster-live-preview__enabled-tool-card-label {
  font-size: 0.56rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  color: rgba(15, 23, 42, 0.72);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-width: 100%;
  word-break: break-word;
}

/* ── Chart / image thumbnail grid ── */

.tool-cluster-live-preview__chart-grid {
  display: grid;
  gap: 0.5rem;
}

.tool-cluster-live-preview__chart-grid[data-count="1"] {
  grid-template-columns: 1fr;
}

.tool-cluster-live-preview__chart-grid[data-count="2"] {
  grid-template-columns: 1fr 1fr;
}

.tool-cluster-live-preview__chart-grid[data-count="3"],
.tool-cluster-live-preview__chart-grid[data-count="4"] {
  grid-template-columns: 1fr 1fr;
}

/* ── Card ── */

.tool-cluster-live-preview__chart-thumb {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid rgba(99, 102, 241, 0.10);
  background: #fff;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 2px 8px rgba(99, 102, 241, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-cluster-live-preview__chart-thumb:hover {
  border-color: rgba(99, 102, 241, 0.22);
  box-shadow:
    0 2px 6px rgba(15, 23, 42, 0.05),
    0 6px 20px rgba(99, 102, 241, 0.08);
}

/* ── Header ── */

.tool-cluster-live-preview__chart-thumb-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.38rem 0.5rem;
  background: linear-gradient(
    180deg,
    rgba(238, 242, 255, 0.5) 0%,
    rgba(245, 243, 255, 0.18) 100%
  );
  border-bottom: 1px solid rgba(99, 102, 241, 0.06);
}

.tool-cluster-live-preview__chart-thumb-header-dot {
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(99, 102, 241, 0.35);
}

.tool-cluster-live-preview__chart-thumb-header-dot[data-kind="image"] {
  background: rgba(168, 85, 247, 0.4);
}

.tool-cluster-live-preview__chart-thumb-header-dot[data-kind="video"] {
  background: rgba(225, 29, 72, 0.42);
}

.tool-cluster-live-preview__chart-thumb-header-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(99, 102, 241, 0.55);
}

.tool-cluster-live-preview__chart-thumb-header-dot[data-kind="image"]
  ~ .tool-cluster-live-preview__chart-thumb-header-label {
  color: rgba(168, 85, 247, 0.55);
}

.tool-cluster-live-preview__chart-thumb-header-dot[data-kind="video"]
  ~ .tool-cluster-live-preview__chart-thumb-header-label {
  color: rgba(190, 24, 93, 0.58);
}

/* ── Image ── */

.tool-cluster-live-preview__chart-thumb-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tool-cluster-live-preview__chart-thumb-img-bg {
  position: absolute;
  inset: -12px;
  width: calc(100% + 24px);
  height: calc(100% + 24px);
  object-fit: cover;
  filter: blur(20px) saturate(1.3) brightness(1.05);
  opacity: 0.55;
  pointer-events: none;
}

.tool-cluster-live-preview__chart-thumb-img {
  position: relative;
  width: 100%;
  max-height: 14rem;
  object-fit: contain;
  display: block;
}

.tool-cluster-live-preview__chart-thumb[data-single="false"] .tool-cluster-live-preview__chart-thumb-img {
  max-height: 10rem;
}

/* ── Title ── */

.tool-cluster-live-preview__chart-thumb-title {
  padding: 0.3rem 0.55rem 0.35rem;
  font-size: 0.64rem;
  font-weight: 500;
  color: rgba(15, 23, 42, 0.6);
  line-height: 1.35;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-top: 1px solid rgba(99, 102, 241, 0.05);
}

.tool-cluster-live-preview__search-query {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.18rem;
  padding: 0.22rem 0.52rem 0.22rem 0.38rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(99, 102, 241, 0.05) 100%);
  border: 1px solid rgba(37, 99, 235, 0.08);
  border-radius: 999px;
  max-width: 100%;
  align-self: flex-start;
}

.tool-cluster-live-preview__search-query-icon {
  width: 0.62rem;
  height: 0.62rem;
  color: #6366f1;
  flex-shrink: 0;
  opacity: 0.6;
}

.tool-cluster-live-preview__search-query-text {
  font-size: 0.62rem;
  font-weight: 500;
  color: #4338ca;
  letter-spacing: -0.005em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  opacity: 0.85;
}

.tool-cluster-live-preview__search-results {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0 0 0.22rem;
  list-style: none;
  display: grid;
  gap: 0;
  border-top: none;
}

.tool-cluster-live-preview__search-result-row {
  min-height: 0;
}

.tool-cluster-live-preview__search-result-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.44rem;
  color: inherit;
  text-decoration: none;
  border-radius: 0;
  padding: 0.32rem 0.56rem;
  border: none;
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
  background: transparent;
  transition: background 0.15s ease;
}

.tool-cluster-live-preview__search-result-row:last-child .tool-cluster-live-preview__search-result-link {
  border-bottom: none;
  border-radius: 0 0 0.58rem 0.58rem;
}

.tool-cluster-live-preview__search-result-link:hover,
.tool-cluster-live-preview__search-result-link:focus-visible {
  background: rgba(37, 99, 235, 0.035);
  box-shadow: none;
  border-color: rgba(15, 23, 42, 0.04);
  outline: none;
}

.tool-cluster-live-preview__search-result-favicon-wrap {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 0.28rem;
  background: rgba(241, 245, 249, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.15);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.tool-cluster-live-preview__search-result-favicon {
  width: 0.68rem;
  height: 0.68rem;
  object-fit: contain;
  display: block;
}

.tool-cluster-live-preview__search-result-title {
  min-width: 0;
  font-size: 0.68rem;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.32;
  letter-spacing: -0.008em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-cluster-live-preview__search-result-host {
  font-size: 0.58rem;
  font-weight: 450;
  color: rgba(100, 116, 139, 0.78);
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: 0.005em;
}

.tool-cluster-live-preview__search-result-external {
  display: grid;
  place-items: center;
  color: rgba(148, 163, 184, 0.4);
  transition: color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.tool-cluster-live-preview__search-result-external svg {
  width: 0.62rem;
  height: 0.62rem;
  stroke-width: 2.2;
}

.tool-cluster-live-preview__search-result-link:hover .tool-cluster-live-preview__search-result-external {
  color: rgba(37, 99, 235, 0.55);
  transform: translate(0.5px, -0.5px);
}

.tool-cluster-live-preview__entry-time {
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #94a3b8;
  opacity: 0.7;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  align-self: center;
  transition: opacity 0.15s ease;
}

.tool-cluster-live-preview__entry:hover .tool-cluster-live-preview__entry-time {
  opacity: 1;
}

.tool-cluster-live-preview__more-link {
  width: 100%;
  margin: 0 0 0.14rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1d4ed8;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.34rem;
  cursor: pointer;
}

.tool-cluster-live-preview__more-link-line {
  height: 1px;
  flex: 1;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.42), rgba(59, 130, 246, 0.12));
}

.tool-cluster-live-preview__more-link-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.38);
  background: rgba(219, 234, 254, 0.68);
  color: #1e3a8a;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.tool-cluster-live-preview__more-link:hover,
.tool-cluster-live-preview__more-link:focus-visible {
  color: #1e40af;
  outline: none;
}

.tool-cluster-live-preview__more-link:hover .tool-cluster-live-preview__more-link-label,
.tool-cluster-live-preview__more-link:focus-visible .tool-cluster-live-preview__more-link-label {
  border-color: rgba(37, 99, 235, 0.56);
  background: rgba(191, 219, 254, 0.74);
  transform: translateY(-1px);
}

.tool-cluster-live-preview__more-link:hover .tool-cluster-live-preview__more-link-line,
.tool-cluster-live-preview__more-link:focus-visible .tool-cluster-live-preview__more-link-line {
  background: linear-gradient(90deg, rgba(29, 78, 216, 0.14), rgba(37, 99, 235, 0.6), rgba(29, 78, 216, 0.14));
}

.tool-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.tool-cluster--collapsible.tool-cluster--collapsed .tool-chip-list,
.tool-cluster--collapsible.tool-cluster--collapsed .tool-cluster-detail-host {
  display: none;
}

.tool-cluster-detail-host {
  width: 100%;
  margin-top: 0.65rem;
}

.tool-cluster-separate-list {
  display: flex;
  flex-direction: column;
  gap: var(--timeline-row-gap);
}

.tool-cluster-separate-card {
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 14px 30px rgba(15, 23, 42, 0.05);
  padding: 0.85rem 1rem 1rem;
}

.tool-cluster-separate-card__header {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.6rem;
}

.tool-cluster-separate-card__icon {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.tool-cluster-separate-card__title-wrap {
  min-width: 0;
  flex: 1;
}

.tool-cluster-separate-card__title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tool-cluster-separate-card__label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}

.tool-cluster-separate-card__caption {
  margin-top: 0.2rem;
  font-size: 0.74rem;
  color: #475569;
}

.tool-cluster-separate-card__meta {
  display: inline-block;
  margin-top: 0.24rem;
  font-size: 0.66rem;
  color: #64748b;
}

.tool-cluster-separate-card__body {
  padding-top: 0.1rem;
}

.spawn-agent-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.spawn-agent-charter-scroll {
  max-height: min(28rem, 45vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-overflow-scrolling: touch;
}

.spawn-agent-charter-scroll:focus-visible {
  outline: 3px solid rgba(16, 185, 129, 0.28);
  outline-offset: 2px;
}

.spawn-agent-action-btn {
  width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  padding: 0.43rem 0.75rem;
  font-size: 0.71rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: all 0.16s ease;
  cursor: pointer;
}

.spawn-agent-action-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.spawn-agent-action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.spawn-agent-action-btn--primary {
  color: #ffffff;
  border-color: rgba(79, 70, 229, 0.42);
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.spawn-agent-action-btn--primary:hover:not(:disabled) {
  border-color: rgba(67, 56, 202, 0.5);
  background: linear-gradient(180deg, #5b5fe9 0%, #4338ca 100%);
}

.spawn-agent-action-btn--secondary {
  color: #475569;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.spawn-agent-action-btn--secondary:hover:not(:disabled) {
  color: #334155;
  border-color: rgba(99, 115, 141, 0.4);
  background: rgba(248, 250, 252, 0.96);
}

.spawn-agent-resolution {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px dashed rgba(99, 115, 141, 0.32);
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.7) 0%, rgba(248, 250, 252, 0.75) 100%);
}

.spawn-agent-resolution--created {
  border-color: rgba(16, 185, 129, 0.32);
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.9) 0%, rgba(240, 253, 250, 0.92) 100%);
}

.spawn-agent-resolution--declined {
  border-color: rgba(148, 163, 184, 0.42);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%);
}

.spawn-agent-resolution-text {
  margin: 0;
  font-size: 0.72rem;
  color: #334155;
  font-weight: 600;
}

.spawn-agent-action-error {
  margin: 0;
  font-size: 0.72rem;
  color: #be123c;
}

@media (max-width: 560px) {
  .spawn-agent-actions {
    grid-template-columns: 1fr;
  }
}

.tool-cluster--collapsible:not(.tool-cluster--collapsed) .tool-cluster-live-preview {
  border-color: transparent;
  background: transparent;
}

.tool-cluster--collapsible .tool-cluster-timestamp {
  display: none;
}

.tool-cluster--collapsible.tool-cluster--collapsed .tool-cluster-timestamp {
  display: block;
}

.tool-chip {
  max-width: min(100%, 26rem);
}

.tool-chip-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 4px 10px rgba(15, 23, 42, 0.04);
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  transition: all 0.18s ease;
  cursor: pointer;
  max-width: min(100%, 26rem);
  overflow: hidden;
  text-align: left;
  white-space: nowrap;
}

.tool-chip-trigger:hover,
.tool-chip-trigger:focus-visible {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.08), 0 8px 20px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
  outline: none;
}

.tool-chip.is-open .tool-chip-trigger {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(238, 242, 255, 0.95);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.1), 0 8px 20px rgba(99, 102, 241, 0.12);
}

.tool-chip-icon {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.tool-chip-body {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  overflow: hidden;
}

.tool-chip-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: #0f172a;
  flex-shrink: 0;
}

.tool-chip-caption {
  font-size: 0.68rem;
  color: #64748b;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-provider-badge {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.tool-provider-badge--chip {
  font-size: 0.55rem;
}

.tool-provider-badge--detail {
  font-size: 0.6rem;
}

.tool-provider-badge--timeline {
  font-size: 0.58rem;
}

.tool-chip-spinner {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 9999px;
  border: 2px solid rgba(99, 102, 241, 0.3);
  border-top-color: rgba(79, 70, 229, 0.9);
  animation: tool-chip-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.tool-chip-spinner--icon {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.tool-chip-separator {
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 9999px;
  background: rgba(100, 116, 139, 0.4);
  flex-shrink: 0;
}

.tool-chip-detail {
  width: min(30rem, 100%);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1), 0 16px 48px rgba(15, 23, 42, 0.06);
  padding: 0.85rem 1rem 1rem;
}

.tool-cluster-detail-host {
  width: 100%;
  margin-top: 0.65rem;
}

.tool-cluster-detail-host[hidden] {
  display: none;
}

.tool-cluster-timestamp {
  align-self: flex-start;
  margin-top: 0.25rem;
  margin-left: 0.15rem;
}

.tool-chip-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.tool-chip-detail-icon {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.tool-chip-detail-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.tool-chip-detail-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tool-chip-detail-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
}

.tool-chip-detail-meta {
  font-size: 0.7rem;
  color: #64748b;
}

.tool-chip-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0.2rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-chip-close:hover,
.tool-chip-close:focus-visible {
  color: #475569;
  background-color: rgba(148, 163, 184, 0.15);
  outline: none;
}

.tool-chip-panel {
  margin-top: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(226, 232, 240, 0.5);
  background: rgba(248, 250, 252, 0.7);
  padding: 0.85rem 0.95rem;
  font-size: 0.8rem;
  color: #475569;
  max-height: min(28rem, 55vh);
  overflow-y: auto;
}

.tool-chip-panel-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4f46e5;
}

.tool-chip-panel-body {
  margin-top: 0.35rem;
  font-size: 0.86rem;
  color: #334155;
}

/* Tool cluster timeline overlay */
.tool-cluster-timeline-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}

.collapsed-event-group-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.collapsed-event-group-modal {
  outline: none;
}

.tool-cluster-timeline-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tool-cluster-timeline-dialog {
  position: relative;
  z-index: 1;
  width: min(820px, 94vw);
  max-height: min(85vh, 780px);
  display: flex;
  flex-direction: column;
  border-radius: 1.75rem;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(234, 247, 255, 0.95));
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  overflow: hidden;
  animation: tool-cluster-timeline-in 0.22s ease;
}

.tool-cluster-timeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem 0.4rem;
}

.tool-cluster-timeline-title {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tool-cluster-timeline-count {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.tool-cluster-timeline-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: #475569;
}

.tool-cluster-timeline-close {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.86);
  color: #475569;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tool-cluster-timeline-close:hover,
.tool-cluster-timeline-close:focus-visible {
  background: rgba(255, 255, 255, 0.98);
  color: #0f172a;
  outline: none;
}

.tool-cluster-timeline-body {
  padding: 0 1rem 1rem;
  overflow-y: auto;
}

.tool-cluster-timeline-list {
  --timeline-icon-size: 1.85rem;
  --timeline-row-padding-x: 0.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tool-cluster-timeline-list::before {
  content: "";
  position: absolute;
  left: calc(var(--timeline-row-padding-x) + (var(--timeline-icon-size) / 2));
  top: calc(0.48rem + var(--timeline-icon-size));
  bottom: calc(0.48rem + var(--timeline-icon-size));
  width: 2px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.28), rgba(14, 165, 233, 0.18));
  opacity: 0.7;
}

.tool-cluster-timeline-item {
  position: relative;
}

.tool-cluster-timeline-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  padding: 0.48rem var(--timeline-row-padding-x);
  border-radius: 0.8rem;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.tool-cluster-timeline-row:hover,
.tool-cluster-timeline-row:focus-visible {
  background: rgba(224, 231, 255, 0.6);
  border-color: rgba(99, 102, 241, 0.28);
  outline: none;
}

.tool-cluster-timeline-row[data-open="true"] {
  background: rgba(224, 231, 255, 0.72);
  border-color: rgba(99, 102, 241, 0.4);
}

.tool-cluster-timeline-icon {
  display: grid;
  place-items: center;
  width: var(--timeline-icon-size);
  height: var(--timeline-icon-size);
  border-radius: 0.75rem;
  flex-shrink: 0;
  align-self: center;
}

.tool-cluster-timeline-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.tool-cluster-timeline-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
}

.tool-cluster-timeline-label-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tool-cluster-timeline-caption {
  font-size: 0.7rem;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-cluster-timeline-preview {
  font-size: 0.73rem;
  color: #334155;
  line-height: 1.35;
}

.tool-cluster-timeline-preview-markdown,
.tool-cluster-timeline-preview-markdown > p {
  margin: 0;
}

.json-view-panel .icon-container {
  display: none !important;
}

.json-view-panel .brace-row {
  gap: 0;
}

.json-view-panel .object-key {
  font-weight: 600;
}

.tool-cluster-timeline-item[data-kind="thinking"] .tool-cluster-timeline-preview {
  font-style: italic;
  color: #1f2937;
}

.tool-cluster-timeline-time {
  font-size: 0.66rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  margin-top: 0.15rem;
}

.tool-cluster-timeline-detail {
  margin: 0.35rem 0 0 calc(var(--timeline-row-padding-x) + var(--timeline-icon-size) + 0.35rem);
  padding-left: 1rem;
  border-left: 2px solid rgba(99, 102, 241, 0.22);
}

@keyframes tool-cluster-timeline-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tool-cluster-timeline-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tool-cluster-live-dot-pulse {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(0.82);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes tool-cluster-live-row-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 rgba(14, 116, 144, 0.12);
  }
  50% {
    box-shadow: inset 0 0 0 1px rgba(14, 116, 144, 0.2);
  }
}

@keyframes tool-cluster-live-new-entry {
  0% {
    transform: translateY(5px);
    opacity: 0.4;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes tool-cluster-live-pulse-start {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
  }
}

@keyframes tool-cluster-live-pulse-finish {
  0% {
    opacity: 0.62;
  }
  100% {
    opacity: 0;
  }
}

@keyframes tool-chip-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .tool-cluster-summary {
    width: 100%;
  }

  .tool-cluster-live-preview {
    padding: 0;
    gap: 0.24rem;
  }

  .tool-cluster-live-preview__entry {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .tool-cluster-live-preview__entry-time {
    display: none;
  }

  .tool-cluster-live-preview__entry-context {
    display: none;
  }

  .tool-cluster-timeline-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .collapsed-event-group-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .tool-cluster-timeline-dialog {
    width: 100%;
    max-height: 86vh;
    border-radius: 1.5rem 1.5rem 0 0;
    animation: tool-cluster-timeline-up 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .tool-cluster-timeline-header {
    padding: 0.8rem 1rem 0.4rem;
  }

  .tool-cluster-timeline-body {
    padding: 0 1rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-cluster-timeline-dialog {
    animation: none;
  }

  .tool-cluster-timeline-row {
    transition: none;
  }

  .tool-cluster-live-preview,
  .tool-cluster-live-preview__entry {
    transition: none;
  }

  .tool-cluster-live-preview__badge-dot,
  .tool-cluster-live-preview__entry[data-active="true"],
  .tool-cluster-live-preview__entry[data-new="true"],
  .tool-cluster-live-preview__pulse,
  .tool-chip-spinner {
    animation: none;
  }
}

.tool-search-query-inline {
  font-weight: 400;
  color: #334155;
}

/* Tool search callouts */
.tool-search-callout {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(248, 250, 252, 0.9);
  padding: 1rem 1.1rem;
}

.tool-search-callout-icon {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 9999px;
  flex-shrink: 0;
  background: rgba(99, 102, 241, 0.1);
  color: #4338ca;
}

.tool-search-callout--success {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(220, 252, 231, 0.85);
}

.tool-search-callout--success .tool-search-callout-icon {
  background: rgba(22, 163, 74, 0.18);
  color: #047857;
}

.tool-search-callout--info {
  border-color: rgba(59, 130, 246, 0.28);
  background: rgba(219, 234, 254, 0.85);
}

.tool-search-callout--info .tool-search-callout-icon {
  background: rgba(59, 130, 246, 0.18);
  color: #1d4ed8;
}

.tool-search-callout--error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(254, 226, 226, 0.9);
}

.tool-search-callout--error .tool-search-callout-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
}

.tool-search-callout-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.tool-search-callout-body {
  display: grid;
  gap: 0.3rem;
  line-height: 1.45;
  color: #334155;
}

.tool-search-callout-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.tool-search-callout-list-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #1f2937;
}

.tool-search-callout-list-label {
  font-weight: 600;
  color: #1f2937;
}

.tool-search-callout-list-items {
  color: #334155;
}

.tool-search-callout-body p {
  margin: 0;
}

.tool-search-suggestion-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.tool-search-suggestion-card {
  border-radius: 0.85rem;
  border: 1px solid rgba(203, 213, 225, 0.5);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.9rem 1rem;
}

.tool-search-suggestion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.tool-search-suggestion-name {
  font-weight: 600;
  color: #0f172a;
}

.tool-search-suggestion-source {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.12);
  color: #1e3a8a;
}

.tool-search-suggestion-description {
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.45;
}

.tool-search-suggestion-note {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: #64748b;
}

.tool-search-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tool-search-list li {
  padding-left: 1.1rem;
  position: relative;
  font-size: 0.78rem;
  color: #475569;
}

.tool-search-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.4);
}

/* External Resources */
.external-resources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.external-resource-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(203, 213, 225, 0.45);
  background: rgba(255, 255, 255, 0.85);
  transition: all 0.15s ease;
}

.external-resource-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
  transform: translateY(-1px);
}

.external-resource-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
  color: #6366f1;
}

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

.external-resource-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.external-resource-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: #1e293b;
}

.external-resource-link {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  border-radius: 0.35rem;
  color: #94a3b8;
  transition: all 0.15s ease;
}

.external-resource-link:hover {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
}

.external-resource-description {
  font-size: 0.78rem;
  line-height: 1.45;
  color: #64748b;
  margin: 0;
}

.external-resource-url {
  font-size: 0.72rem;
  color: #6366f1;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.external-resource-url:hover {
  color: #4f46e5;
  text-decoration: underline;
}

.tool-search-result-card {
  border-radius: 0.85rem;
  border: 1px solid rgba(203, 213, 225, 0.5);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.85rem 1rem;
}

.tool-search-result-title {
  font-weight: 500;
  color: #0f172a;
  margin-bottom: 0.2rem;
}

.tool-search-result-link {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: #3730a3;
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-search-result-link:hover,
.tool-search-result-link:focus-visible {
  text-decoration: underline;
}

.tool-search-result-snippet {
  margin-top: 0.35rem;
  font-size: 0.74rem;
  color: #475569;
  line-height: 1.45;
}

/* Schedule Cards */
.schedule-card {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  border-radius: 0.9rem;
  border: 1px solid rgba(99, 102, 241, 0.1);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.06), rgba(129, 140, 248, 0.03));
  padding: 0.85rem 1rem;
}

.schedule-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: rgba(79, 70, 229, 0.12);
  color: #3730a3;
}

.schedule-card-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.schedule-card-label {
  font-weight: 600;
  color: #312e81;
}

.schedule-card-description {
  margin-top: 0.2rem;
  color: #4c1d95;
  font-size: 0.85rem;
}

.schedule-interval {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.schedule-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.1);
  color: #0c4a6e;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
}

.schedule-pill-value {
  font-size: 0.95rem;
}

.schedule-pill-unit {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.schedule-note {
  margin-top: 0.75rem;
  color: #475569;
  font-size: 0.85rem;
}

.schedule-cron-grid {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
  gap: 0.65rem 1.2rem;
  font-size: 0.85rem;
}

.schedule-cron-grid dt {
  font-weight: 600;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.schedule-cron-grid dd {
  margin: 0;
  color: #334155;
}

.schedule-cron-grid code {
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
  border-radius: 0.35rem;
  padding: 0.15rem 0.4rem;
}

/* Schedule Hero Card */
.schedule-hero {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.125rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 0.875rem;
  position: relative;
  overflow: hidden;
}

.schedule-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(139, 92, 246, 0.04) 100%);
  pointer-events: none;
}

.schedule-hero--disabled {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.05) 0%, rgba(148, 163, 184, 0.03) 100%);
  border-color: rgba(100, 116, 139, 0.1);
}

.schedule-hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.06), 0 2px 8px rgba(99, 102, 241, 0.04);
  flex-shrink: 0;
}

.schedule-hero--disabled .schedule-hero-icon {
  box-shadow: 0 1px 3px rgba(100, 116, 139, 0.06), 0 2px 8px rgba(100, 116, 139, 0.04);
}

.schedule-hero-emoji {
  font-size: 1.375rem;
  line-height: 1;
}

.schedule-hero-content {
  flex: 1;
  min-width: 0;
}

.schedule-hero-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6366f1;
  margin: 0 0 0.125rem 0;
}

.schedule-hero--disabled .schedule-hero-label {
  color: #64748b;
}

.schedule-hero-value {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #312e81;
  margin: 0;
  line-height: 1.3;
}

.schedule-hero--disabled .schedule-hero-value {
  color: #475569;
}

.schedule-hero-badge {
  width: 1.125rem;
  height: 1.125rem;
  color: rgba(99, 102, 241, 0.3);
  flex-shrink: 0;
}

.schedule-hero--disabled .schedule-hero-badge {
  color: rgba(100, 116, 139, 0.25);
}

/* ==========================================================================
   Thinking Window - Unified reasoning/thinking display
   ========================================================================== */

.thinking-event {
  align-items: flex-start;
}

.thinking-window {
  max-width: 100%;
  position: relative;
  border-radius: 0.875rem;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(139, 92, 246, 0.02) 3px,
      rgba(139, 92, 246, 0.02) 4px
    ),
    linear-gradient(145deg, rgba(250, 245, 255, 0.92) 0%, rgba(243, 237, 255, 0.95) 100%);
  backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(139, 92, 246, 0.18);
  overflow: hidden;
  box-shadow:
    0 0 1px rgba(139, 92, 246, 0.2),
    0 2px 12px rgba(139, 92, 246, 0.06);
}

.thinking-window[data-streaming='true'] {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow:
    0 0 1px rgba(139, 92, 246, 0.35),
    0 0 10px rgba(139, 92, 246, 0.06),
    0 2px 16px rgba(139, 92, 246, 0.08);
  animation: thinkingWindowGlow 3s ease-in-out infinite;
}

@keyframes thinkingWindowGlow {
  0%, 100% {
    box-shadow:
      0 0 1px rgba(139, 92, 246, 0.35),
      0 0 10px rgba(139, 92, 246, 0.05),
      0 2px 16px rgba(139, 92, 246, 0.07);
  }
  50% {
    box-shadow:
      0 0 1px rgba(139, 92, 246, 0.45),
      0 0 16px rgba(139, 92, 246, 0.1),
      0 2px 20px rgba(139, 92, 246, 0.1);
  }
}

/* Subtle top-edge highlight */
.thinking-window::before {
  content: '';
  position: absolute;
  top: 0;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.25), transparent);
  pointer-events: none;
  z-index: 1;
}

.thinking-window-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.875rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 600;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: background 0.15s ease;
  position: relative;
  z-index: 1;
}

.thinking-window-header:hover {
  background: rgba(139, 92, 246, 0.05);
}

.thinking-window-header:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.4);
  outline-offset: -2px;
}

.thinking-window-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  color: #8b5cf6;
}

.thinking-window-icon svg {
  width: 0.875rem;
  height: 0.875rem;
}

.thinking-window-pulse {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: radial-gradient(circle, #c4b5fd 0%, #8b5cf6 60%, #7c3aed 100%);
  box-shadow:
    0 0 4px rgba(139, 92, 246, 0.5),
    0 0 8px rgba(139, 92, 246, 0.2);
  animation: thinkingWindowPulse 1.4s ease-in-out infinite;
}

@keyframes thinkingWindowPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    box-shadow:
      0 0 4px rgba(139, 92, 246, 0.5),
      0 0 8px rgba(139, 92, 246, 0.2);
  }
  50% {
    transform: scale(1.25);
    opacity: 0.9;
    box-shadow:
      0 0 6px rgba(139, 92, 246, 0.7),
      0 0 14px rgba(139, 92, 246, 0.3);
  }
}

.thinking-window-label {
  flex: 1;
  text-align: left;
}

.thinking-window-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0.875rem;
  height: 0.875rem;
  color: rgba(139, 92, 246, 0.5);
  transition: transform 0.2s ease;
}

.thinking-window-chevron svg {
  width: 0.75rem;
  height: 0.75rem;
}

.thinking-window-chevron[data-collapsed='true'] {
  transform: rotate(-90deg);
}

.thinking-window-content {
  height: 8rem;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  padding: 0 0.875rem 0.75rem;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  color: #5b21b6;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  animation: thinkingWindowFadeIn 0.2s ease;
  position: relative;
  z-index: 1;
}

.thinking-window-content::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

@keyframes thinkingWindowFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Streaming Reply Card
   ========================================================================== */

.streaming-reply-event {
  align-items: flex-start;
}

.streaming-reply-bubble {
  position: relative;
}

.streaming-reply-bubble[data-streaming='true']::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #6366f1;
  animation: streamingCursor 1s ease-in-out infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes streamingCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Timeline stack spacing is controlled by --timeline-row-gap. */

/* ── Streaming Thinking Card ─────────────────────────────────────── */

.streaming-thinking-card {
  position: relative;
  border-radius: 0.75rem;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(139, 92, 246, 0.02) 3px,
      rgba(139, 92, 246, 0.02) 4px
    ),
    linear-gradient(145deg, rgba(250, 245, 255, 0.92) 0%, rgba(243, 237, 255, 0.95) 100%);
  backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(139, 92, 246, 0.22);
  padding: 0.5rem 0.75rem;
  box-shadow:
    0 0 1px rgba(139, 92, 246, 0.25),
    0 0 8px rgba(139, 92, 246, 0.05);
  animation: thinkingWindowGlow 3s ease-in-out infinite;
}

/* Subtle top-edge highlight */
.streaming-thinking-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0.75rem;
  right: 0.75rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.2), transparent);
  pointer-events: none;
}

.streaming-thinking-card__header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.25rem;
}

.streaming-thinking-card__pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #c4b5fd 0%, #8b5cf6 60%, #7c3aed 100%);
  box-shadow:
    0 0 4px rgba(139, 92, 246, 0.5),
    0 0 8px rgba(139, 92, 246, 0.2);
  animation: thinkingWindowPulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

.streaming-thinking-card__label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}

.streaming-thinking-card__content {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #5b21b6;
  max-height: calc(1.4em * 3);
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  scrollbar-width: none;
}

.streaming-thinking-card__content::-webkit-scrollbar {
  display: none;
}

.streaming-thinking-card__cursor {
  display: inline-block;
  width: 2px;
  height: 0.875em;
  background: #8b5cf6;
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: streamingCursor 1s ease-in-out infinite;
  box-shadow: 0 0 4px rgba(139, 92, 246, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .streaming-thinking-card__pulse {
    animation: none;
  }
  .streaming-thinking-card__cursor {
    animation: none;
    opacity: 0.6;
  }
  .streaming-thinking-card {
    animation: none;
  }
}

.streaming-reply-event[data-waiting='true'] .streaming-reply-bubble {
  animation: streamingWaitingPulse 1.5s ease-in-out infinite;
}

@keyframes streamingWaitingPulse {
  0%, 100% {
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 4px 12px rgba(15, 23, 42, 0.03);
  }
  50% {
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 4px 12px rgba(15, 23, 42, 0.03), 0 0 0 2px rgba(99, 102, 241, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .streaming-reply-event[data-waiting='true'] .streaming-reply-bubble {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thinking-window[data-streaming='true'] {
    animation: none;
  }
}

/* ==========================================================================
   Chat Sidebar - Glassmorphic navigation
   ========================================================================== */

.chat-sidebar {
  --sidebar-bg: #1e1145;
  --agent-chat-sidebar-current-width: var(--agent-chat-sidebar-width, 18rem);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--agent-chat-sidebar-current-width);
  z-index: 40;
  display: flex;
  flex-direction: column;
  background-color: var(--agent-chat-purple-base);
  isolation: isolate;
  background: var(--agent-chat-purple-background);
  border-right: 1px solid rgba(139, 92, 246, 0.08);
  transition: width 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image: var(--agent-chat-grain-texture);
  background-size: 200px 200px;
  background-repeat: repeat;
  mix-blend-mode: screen;
}

/* Subtle inner highlight along the right edge */
.chat-sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  z-index: 2;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.04) 50%, transparent 100%);
  pointer-events: none;
}

.chat-sidebar-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 0;
  padding: 0 0.375rem;
}

.chat-sidebar-settings-theme {
  --chat-sidebar-settings-banner-surface: rgba(15, 23, 42, 0.82);
  --chat-sidebar-settings-surface: rgba(2, 6, 23, 0.44);
  --chat-sidebar-settings-surface-soft: rgba(2, 6, 23, 0.32);
  --chat-sidebar-settings-surface-strong: var(--chat-sidebar-settings-banner-surface);
  --chat-sidebar-settings-border: rgba(148, 163, 184, 0.18);
  --chat-sidebar-settings-border-strong: rgba(148, 163, 184, 0.26);
  --chat-sidebar-settings-text: rgba(248, 250, 252, 0.96);
  --chat-sidebar-settings-muted: rgba(226, 232, 240, 0.78);
  --chat-sidebar-settings-soft-text: rgba(203, 213, 225, 0.66);
  color-scheme: dark;
  padding: 0 0.35rem 1.5rem;
  color: var(--chat-sidebar-settings-text);
}

.chat-sidebar-settings-shell {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.35rem;
  padding: 0.95rem 1rem 1.25rem;
  background: var(--chat-sidebar-settings-banner-surface);
}

.chat-sidebar-settings-theme .text-slate-900,
.chat-sidebar-settings-theme .text-slate-800,
.chat-sidebar-settings-theme .text-slate-700,
.chat-sidebar-settings-theme .text-gray-900,
.chat-sidebar-settings-theme .text-gray-800,
.chat-sidebar-settings-theme .text-gray-700 {
  color: var(--chat-sidebar-settings-text);
}

.chat-sidebar-settings-theme .text-slate-600,
.chat-sidebar-settings-theme .text-slate-500,
.chat-sidebar-settings-theme .text-gray-600,
.chat-sidebar-settings-theme .text-gray-500,
.chat-sidebar-settings-theme .text-indigo-800,
.chat-sidebar-settings-theme .text-indigo-700 {
  color: var(--chat-sidebar-settings-muted);
}

.chat-sidebar-settings-theme .text-slate-400,
.chat-sidebar-settings-theme .text-gray-400 {
  color: var(--chat-sidebar-settings-soft-text);
}

.chat-sidebar-settings-theme .text-blue-600,
.chat-sidebar-settings-theme .text-blue-700,
.chat-sidebar-settings-theme .text-blue-800 {
  color: #93c5fd;
}

.chat-sidebar-settings-theme .text-green-600,
.chat-sidebar-settings-theme .text-emerald-600,
.chat-sidebar-settings-theme .text-emerald-700 {
  color: #86efac;
}

.chat-sidebar-settings-theme .text-amber-600,
.chat-sidebar-settings-theme .text-amber-700,
.chat-sidebar-settings-theme .text-amber-800 {
  color: #fcd34d;
}

.chat-sidebar-settings-theme .text-red-600,
.chat-sidebar-settings-theme .text-red-700,
.chat-sidebar-settings-theme .text-red-800,
.chat-sidebar-settings-theme .text-rose-600,
.chat-sidebar-settings-theme .text-rose-700 {
  color: #fda4af;
}

.chat-sidebar-settings-theme .border-gray-200,
.chat-sidebar-settings-theme .border-gray-300,
.chat-sidebar-settings-theme .border-slate-200,
.chat-sidebar-settings-theme .border-slate-300,
.chat-sidebar-settings-theme .border-indigo-100,
.chat-sidebar-settings-theme .border-amber-200,
.chat-sidebar-settings-theme .border-red-200,
.chat-sidebar-settings-theme .border-red-300,
.chat-sidebar-settings-theme .border-blue-200 {
  border-color: var(--chat-sidebar-settings-border-strong);
}

.chat-sidebar-settings-theme .border-slate-200\/70,
.chat-sidebar-settings-theme .border-slate-300\/70 {
  border-color: var(--chat-sidebar-settings-border);
}

.chat-sidebar-settings-theme .bg-white,
.chat-sidebar-settings-theme .bg-white\/70,
.chat-sidebar-settings-theme .bg-white\/80,
.chat-sidebar-settings-theme .bg-gray-100 {
  background-color: var(--chat-sidebar-settings-surface-strong);
}

.chat-sidebar-settings-theme .bg-gray-50,
.chat-sidebar-settings-theme .bg-gray-50\/60 {
  background-color: var(--chat-sidebar-settings-surface-soft);
}

.chat-sidebar-settings-theme .bg-blue-50\/50,
.chat-sidebar-settings-theme .bg-blue-50\/60,
.chat-sidebar-settings-theme .bg-blue-50\/70 {
  background-color: rgba(30, 64, 175, 0.22);
}

.chat-sidebar-settings-theme .bg-blue-50 {
  background-color: rgba(30, 64, 175, 0.18);
}

.chat-sidebar-settings-theme .bg-indigo-50 {
  background-color: rgba(79, 70, 229, 0.18);
}

.chat-sidebar-settings-theme .bg-emerald-50 {
  background-color: rgba(20, 83, 45, 0.22);
}

.chat-sidebar-settings-theme .bg-red-50 {
  background-color: rgba(127, 29, 29, 0.2);
}

.chat-sidebar-settings-theme .bg-amber-50 {
  background-color: rgba(120, 53, 15, 0.22);
}

.chat-sidebar-settings-theme .bg-slate-100 {
  background-color: rgba(30, 41, 59, 0.65);
}

.chat-sidebar-settings-theme .bg-red-100 {
  background-color: rgba(127, 29, 29, 0.34);
}

.chat-sidebar-settings-theme .bg-green-100 {
  background-color: rgba(20, 83, 45, 0.34);
}

.chat-sidebar-settings-theme .bg-amber-100 {
  background-color: rgba(120, 53, 15, 0.34);
}

.chat-sidebar-settings-theme input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']),
.chat-sidebar-settings-theme textarea,
.chat-sidebar-settings-theme select {
  background: var(--chat-sidebar-settings-surface-strong);
  border-color: var(--chat-sidebar-settings-border-strong);
  color: var(--chat-sidebar-settings-text);
  box-shadow: none;
}

.chat-sidebar-settings-theme input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file'])::placeholder,
.chat-sidebar-settings-theme textarea::placeholder {
  color: var(--chat-sidebar-settings-soft-text);
}

.chat-sidebar-settings-theme input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']):focus,
.chat-sidebar-settings-theme textarea:focus,
.chat-sidebar-settings-theme select:focus {
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2);
  outline: none;
}

.chat-sidebar-settings-theme input[type='checkbox'],
.chat-sidebar-settings-theme input[type='radio'] {
  accent-color: #60a5fa;
}

.chat-sidebar-settings-theme table {
  color: var(--chat-sidebar-settings-muted);
}

.chat-sidebar-settings-theme thead,
.chat-sidebar-settings-theme tbody,
.chat-sidebar-settings-theme tr {
  background: transparent;
}

.chat-sidebar-settings-theme .shadow,
.chat-sidebar-settings-theme .shadow-sm,
.chat-sidebar-settings-theme .shadow-xl,
.chat-sidebar-settings-theme .shadow-inner {
  box-shadow: none;
}

.chat-sidebar--collapsed .chat-sidebar-inner {
  padding: 0;
  overflow: visible;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--agent-chat-banner-height, 3.5rem);
  padding: 0.875rem 0.375rem 0;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.chat-sidebar-header[data-has-center='true'] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  column-gap: 0.75rem;
}

.chat-sidebar-header[data-collapsed='true'] {
  justify-content: center;
  padding: 0.875rem 0.25rem 0;
}

.chat-sidebar-header-start,
.chat-sidebar-header-center {
  display: flex;
  align-items: center;
  min-width: 0;
}

.chat-sidebar-header-center {
  justify-content: center;
}

.chat-sidebar-header-center > * {
  max-width: 100%;
}

.chat-sidebar-logo-link {
  display: flex;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.chat-sidebar-logo-link:hover {
  opacity: 0.8;
}

.chat-sidebar-logo {
  height: 2rem;
  width: auto;
  opacity: 0.88;
  flex-shrink: 0;
}

.chat-sidebar-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  min-width: 0;
}

.chat-sidebar-header-actions .chat-context-switcher {
  min-width: 0;
}

.selection-shell-switcher__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.3rem 0.45rem;
  border: none;
  border-radius: 0.6rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.selection-shell-switcher__trigger:hover,
.selection-shell-switcher__trigger[data-open='true'] {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.selection-shell-switcher__trigger:focus-visible {
  outline: 2px solid rgba(221, 214, 254, 0.36);
  outline-offset: 1px;
}

.selection-shell-switcher__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-shell-switcher__chevron {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  color: rgba(196, 181, 253, 0.78);
  transition: transform 0.15s ease, color 0.15s ease;
}

.selection-shell-switcher__trigger:hover .selection-shell-switcher__chevron,
.selection-shell-switcher__trigger[data-open='true'] .selection-shell-switcher__chevron {
  color: #ddd6fe;
}

.selection-shell-switcher__trigger[data-open='true'] .selection-shell-switcher__chevron {
  transform: rotate(180deg);
}

.selection-shell-switcher__popover {
  z-index: 90;
  width: min(14rem, calc(100vw - 1rem));
}

.selection-shell-switcher__menu {
  width: 100%;
}

.selection-shell-switcher__list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  outline: none;
}

.selection-shell-switcher__item {
  min-height: 2.25rem;
}

.selection-shell-switcher__item[data-selected='true'],
.selection-shell-switcher__item[data-focused='true'] {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.selection-shell-switcher__item-icon,
.selection-shell-switcher__item-check {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.selection-shell-switcher__item-icon {
  color: #c4b5fd;
}

.selection-shell-switcher__item-label {
  flex: 1;
  min-width: 0;
}

.selection-shell-switcher__item-check {
  color: #ffffff;
}

.chat-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.45rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, transform 0.2s ease;
}

.chat-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
}

.chat-sidebar-toggle:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.4);
  outline-offset: 2px;
}

.chat-context-switcher {
  position: relative;
  display: flex;
  align-items: center;
}

.chat-context-switcher__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 11rem;
  padding: 0.35rem 0.55rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chat-context-switcher__trigger[data-busy='true'] {
  opacity: 0.7;
}

.chat-context-switcher__trigger:hover {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.35);
  color: #1e40af;
}

.chat-context-switcher__trigger:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.chat-context-switcher__icon,
.chat-context-switcher__item-icon,
.chat-context-switcher__item-check,
.chat-context-switcher__chevron {
  width: 0.95rem;
  height: 0.95rem;
}

.chat-context-switcher__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

.chat-context-switcher__chevron {
  margin-left: auto;
  transition: transform 0.15s ease;
}

.chat-context-switcher__trigger[data-open='true'] .chat-context-switcher__chevron {
  transform: rotate(180deg);
}

.chat-context-switcher[data-collapsed='true'] .chat-context-switcher__label,
.chat-context-switcher[data-collapsed='true'] .chat-context-switcher__chevron {
  display: none;
}

.chat-context-switcher[data-collapsed='true'] .chat-context-switcher__trigger {
  width: 1.75rem;
  padding: 0.35rem;
  justify-content: center;
}

.chat-context-switcher__popover {
  z-index: 80;
  margin-top: 0.4rem;
  max-width: min(90vw, 18rem);
}

.chat-context-switcher__menu {
  min-width: 13rem;
  padding: 0.45rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(37, 99, 235, 0.2);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(60vh, 20rem);
  overflow: hidden;
}

.chat-context-switcher__list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.chat-context-switcher__section {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

.chat-context-switcher__section:last-child {
  margin-bottom: 0;
}

.chat-context-switcher__heading {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
  font-weight: 700;
  padding: 0 0.35rem;
}

.chat-context-switcher__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: none;
  background: transparent;
  border-radius: 0.6rem;
  text-align: left;
  color: #1f2937;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.chat-context-switcher__item:hover {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.chat-context-switcher__item[data-selected='true'] {
  background: rgba(37, 99, 235, 0.18);
  color: #1d4ed8;
}

.chat-context-switcher__item[data-focused='true'] {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.chat-context-switcher__item[data-disabled='true'],
.chat-context-switcher__item[aria-disabled='true'] {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-context-switcher__item-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-weight: 600;
}

.chat-context-switcher__item-role {
  font-size: 0.65rem;
  color: #475569;
  font-weight: 500;
}

.chat-context-switcher__error {
  margin-top: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  font-size: 0.7rem;
  font-weight: 600;
}

.chat-context-switcher--drawer {
  width: 100%;
}

.chat-context-switcher--drawer .chat-context-switcher__trigger {
  width: 100%;
  justify-content: space-between;
}

.chat-context-switcher--drawer .chat-context-switcher__menu {
  width: 100%;
}

/* Dark theme overrides for context switcher inside sidebar */
.chat-sidebar .chat-context-switcher__trigger {
  border-color: rgba(167, 139, 250, 0.25);
  background: rgba(167, 139, 250, 0.12);
  color: #c4b5fd;
}

.chat-sidebar .chat-context-switcher__trigger:hover {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.4);
  color: #ddd6fe;
}

.chat-sidebar .chat-context-switcher__trigger:focus-visible {
  outline-color: rgba(167, 139, 250, 0.35);
}

.chat-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.chat-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.375rem;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.chat-sidebar-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.18);
  color: #c4b5fd;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0;
}

.chat-sidebar-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.2rem 0.375rem 0.1rem;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.chat-sidebar-agent-list {
  --chat-sidebar-agent-list-fade: 3.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 0 0.375rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.25) transparent;
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0,
    #000 calc(100% - var(--chat-sidebar-agent-list-fade)),
    rgba(0, 0, 0, 0.65) calc(100% - 1.5rem),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0,
    #000 calc(100% - var(--chat-sidebar-agent-list-fade)),
    rgba(0, 0, 0, 0.65) calc(100% - 1.5rem),
    transparent 100%
  );
}

.chat-sidebar-agent-list::before,
.chat-sidebar-agent-list::after {
  content: '';
  display: block;
  flex-shrink: 0;
}

.chat-sidebar-agent-list::before {
  height: 0;
}

.chat-sidebar-agent-list::after {
  height: 0.375rem;
}

.chat-sidebar-agent-list::-webkit-scrollbar {
  width: 4px;
}

.chat-sidebar-agent-list::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.25);
  border-radius: 999px;
}

.chat-sidebar-agent {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 0.5rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.chat-sidebar-agent:hover {
  background: rgba(255, 255, 255, 0.06);
}

.chat-sidebar-agent[data-active='true'] {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.chat-sidebar-agent:focus-visible {
  outline: none;
}

.chat-sidebar-agent:focus-visible .chat-sidebar-agent-avatar {
  box-shadow: 0 0 0 2px var(--sidebar-bg, #1e1145), 0 0 0 4px rgba(167, 139, 250, 0.6);
}

.chat-sidebar-agent[data-active='true'] .chat-sidebar-agent-avatar {
  box-shadow: 0 0 0 2.5px var(--sidebar-bg, #1e1145), 0 0 0 4.5px var(--agent-accent, #6366f1);
}

.chat-sidebar-agent[data-switching='true'] .chat-sidebar-agent-avatar {
  animation: avatar-pulse 1.2s ease-in-out infinite;
}

@keyframes avatar-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2.5px var(--sidebar-bg, #1e1145), 0 0 0 4.5px var(--agent-accent, #6366f1);
  }
  50% {
    box-shadow: 0 0 0 2.5px var(--sidebar-bg, #1e1145), 0 0 0 8px rgba(139, 92, 246, 0.2);
  }
}

.chat-sidebar-agent[data-enabled='false'] {
  opacity: 0.5;
}

.chat-sidebar-agent-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.chat-sidebar-agent-leading {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.chat-sidebar-agent-unread-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.56rem;
  flex: 0 0 0.56rem;
}

.chat-sidebar-agent-unread-dot {
  display: block;
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 999px;
  background: #2df6f5;
  box-shadow: 0 0 0 1px rgba(45, 246, 245, 0.35);
}

.chat-sidebar--collapsed .chat-sidebar-agent-leading {
  gap: 0.28rem;
}

.chat-sidebar--collapsed .chat-sidebar-agent-unread-slot {
  width: 0.54rem;
  flex-basis: 0.54rem;
}

.chat-sidebar--collapsed .chat-sidebar-agent-unread-dot {
  display: block;
  width: 0.52rem;
  height: 0.52rem;
  border: 2px solid var(--sidebar-bg, #1e1145);
}

.chat-sidebar-agent-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--agent-accent, #6366f1);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-sidebar-agent:hover .chat-sidebar-agent-avatar {
  transform: scale(1.08);
}

.chat-sidebar-agent:active .chat-sidebar-agent-avatar {
  transform: scale(0.95);
}

.chat-sidebar-agent-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-sidebar-agent-avatar-text {
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.chat-sidebar-agent-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
  min-width: 0;
  flex: 1;
  padding-top: 0.125rem;
}

.chat-sidebar-agent-trailing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
}

.chat-sidebar-agent-favorite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.42);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.chat-sidebar-agent-favorite:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
}

.chat-sidebar-agent-favorite[data-active='true'] {
  color: #fbbf24;
}

.chat-sidebar-agent-favorite:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.45);
  outline-offset: 1px;
}

.chat-sidebar-agent-name {
  display: block;
  font-weight: 500;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.chat-sidebar-agent[data-active='true'] .chat-sidebar-agent-name {
  font-weight: 700;
  color: #ffffff;
}


.chat-sidebar-agent-desc {
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.chat-sidebar-agent[data-active='true'] .chat-sidebar-agent-desc {
  color: rgba(255, 255, 255, 0.74);
}

.chat-sidebar-agent-state {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fbbf24;
}

.chat-sidebar-agent-empty {
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
}

/* Create agent button */
.chat-sidebar-create-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.5rem;
  margin-bottom: 0.25rem;
  border: 1px dashed rgba(167, 139, 250, 0.25);
  border-radius: 0.5rem;
  background: rgba(167, 139, 250, 0.06);
  color: #c4b5fd;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-sidebar-create-btn:hover {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.4);
}

.chat-sidebar-create-btn:active {
  background: rgba(167, 139, 250, 0.18);
}

.chat-sidebar-create-btn:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.4);
  outline-offset: 2px;
}

.chat-sidebar-create-btn:disabled,
.chat-sidebar-create-btn[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.55;
  border-color: rgba(167, 139, 250, 0.18);
  background: rgba(167, 139, 250, 0.04);
  color: rgba(196, 181, 253, 0.7);
}

.chat-sidebar-create-btn[aria-disabled='true']:hover,
.chat-sidebar-create-btn[aria-disabled='true']:active {
  background: rgba(167, 139, 250, 0.04);
  border-color: rgba(167, 139, 250, 0.18);
}

.chat-sidebar-create-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.15);
  flex-shrink: 0;
}

.chat-sidebar-create-btn-label {
  flex: 1;
  min-width: 0;
}

.chat-sidebar-create-btn[data-collapsed='true'] {
  justify-content: center;
  padding: 0.5rem 0.625rem;
  border: none;
  background: transparent;
}

.chat-sidebar-create-btn[data-collapsed='true']:hover {
  background: rgba(255, 255, 255, 0.06);
}

.chat-sidebar-create-btn[data-collapsed='true']:disabled,
.chat-sidebar-create-btn[data-collapsed='true'][aria-disabled='true'] {
  background: transparent;
}

.chat-sidebar-create-btn[data-collapsed='true'][aria-disabled='true']:hover {
  background: transparent;
}

.chat-sidebar-create-btn[data-collapsed='true'] .chat-sidebar-create-btn-icon {
  width: 2.375rem;
  height: 2.375rem;
  background: transparent;
  border: 2px dashed rgba(167, 139, 250, 0.35);
  color: #c4b5fd;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.chat-sidebar-create-btn[data-collapsed='true']:hover .chat-sidebar-create-btn-icon {
  border-color: rgba(167, 139, 250, 0.6);
  background: rgba(167, 139, 250, 0.1);
}

.chat-sidebar-create-btn[data-collapsed='true']:disabled .chat-sidebar-create-btn-icon,
.chat-sidebar-create-btn[data-collapsed='true'][aria-disabled='true'] .chat-sidebar-create-btn-icon {
  border-color: rgba(167, 139, 250, 0.2);
  background: transparent;
  color: rgba(196, 181, 253, 0.55);
}

.chat-sidebar-create-btn[data-collapsed='true'][aria-disabled='true']:hover .chat-sidebar-create-btn-icon {
  border-color: rgba(167, 139, 250, 0.2);
  background: transparent;
}

/* Drawer variant of create button */
.chat-sidebar-create-btn--drawer {
  padding: 0.875rem 1rem;
  margin-bottom: 0.375rem;
  gap: 0.875rem;
  font-size: 0.9375rem;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  background: rgba(99, 102, 241, 0.06);
  color: #4338ca;
}

.chat-sidebar-create-btn--drawer:hover {
  background: rgba(99, 102, 241, 0.1);
}

.chat-sidebar-create-btn--drawer:active {
  background: rgba(99, 102, 241, 0.15);
}

.chat-sidebar-create-btn--drawer:disabled,
.chat-sidebar-create-btn--drawer[aria-disabled='true'] {
  background: rgba(99, 102, 241, 0.03);
  color: rgba(67, 56, 202, 0.55);
  border-bottom-color: rgba(226, 232, 240, 0.35);
}

.chat-sidebar-create-btn--drawer[aria-disabled='true']:hover,
.chat-sidebar-create-btn--drawer[aria-disabled='true']:active {
  background: rgba(99, 102, 241, 0.03);
}

.chat-sidebar-create-btn--drawer .chat-sidebar-create-btn-icon {
  width: 2.75rem;
  height: 2.75rem;
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}

.chat-sidebar-create-btn--drawer:disabled .chat-sidebar-create-btn-icon,
.chat-sidebar-create-btn--drawer[aria-disabled='true'] .chat-sidebar-create-btn-icon {
  background: rgba(99, 102, 241, 0.05);
  color: rgba(79, 70, 229, 0.55);
}

/* Sidebar search */
.chat-sidebar-controls {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0.25rem;
}

.chat-sidebar-controls .chat-sidebar-search,
.chat-sidebar-controls .chat-sidebar-sort-toggle {
  margin: 0;
}

.chat-sidebar-controls[data-gallery='true'] {
  --chat-sidebar-gallery-control-height: 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.5rem;
}

.chat-sidebar-controls[data-gallery='true'] .chat-sidebar-search {
  min-height: var(--chat-sidebar-gallery-control-height);
}

.chat-sidebar-controls[data-gallery='true'] .chat-sidebar-search-input {
  height: var(--chat-sidebar-gallery-control-height);
}

.chat-sidebar-controls[data-gallery='true'] .chat-sidebar-sort-toggle {
  height: var(--chat-sidebar-gallery-control-height);
  width: 11.25rem;
  padding: 0.1875rem;
}

.chat-sidebar-controls[data-gallery='true'] .chat-sidebar-sort-toggle-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}

.chat-sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 0.25rem;
}

.chat-sidebar-search-icon {
  position: absolute;
  left: 0.5rem;
  width: 0.875rem;
  height: 0.875rem;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.chat-sidebar-search-input {
  width: 100%;
  height: 1.75rem;
  padding: 0 1.75rem 0 1.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.375rem;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.chat-sidebar-search-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.chat-sidebar-search-input:focus {
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

.chat-sidebar-search-clear {
  position: absolute;
  right: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.chat-sidebar-search-clear:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

.chat-sidebar-sort-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem;
  margin: 0 0.25rem;
  padding: 0.2rem;
  border-radius: 0.5rem;
  background: rgba(167, 139, 250, 0.14);
  border: 1px solid rgba(167, 139, 250, 0.2);
}

.chat-sidebar-sort-toggle-button {
  border: none;
  border-radius: 0.35rem;
  padding: 0.3rem 0.45rem;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.62);
  background: transparent;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.chat-sidebar-sort-toggle-button:hover {
  color: rgba(255, 255, 255, 0.9);
}

.chat-sidebar-sort-toggle-button[data-active='true'] {
  color: #ffffff;
  background: rgba(124, 58, 237, 0.6);
}

.sidebar-settings {
  position: relative;
  flex-shrink: 0;
  padding: 0.75rem 0.125rem 0.75rem;
}

.sidebar-settings--drawer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), #ffffff 38%);
  border-top: 1px solid rgba(226, 232, 240, 0.75);
}

.sidebar-settings__trigger {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.625rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.625rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.8125rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-settings__trigger:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(167, 139, 250, 0.38);
  color: #ffffff;
}

.sidebar-settings__trigger:focus-visible {
  outline: none;
}

.sidebar-settings__trigger-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.sidebar-settings__trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-settings[data-collapsed='true'] {
  padding: 0.75rem 0.75rem 0.75rem;
}

.sidebar-settings[data-collapsed='true'] .sidebar-settings__trigger {
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-color: transparent;
  background: transparent;
}

.sidebar-settings[data-collapsed='true'] .sidebar-settings__trigger:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
}

.sidebar-settings--drawer .sidebar-settings__trigger {
  min-height: 3rem;
  justify-content: center;
  border-color: rgba(79, 70, 229, 0.18);
  background: rgba(79, 70, 229, 0.08);
  color: #3730a3;
  font-size: 0.9375rem;
}

.sidebar-settings--drawer .sidebar-settings__trigger:hover,
.sidebar-settings--drawer .sidebar-settings__trigger[data-open='true'] {
  background: rgba(79, 70, 229, 0.13);
  border-color: rgba(79, 70, 229, 0.28);
  color: #312e81;
}

.sidebar-settings__popover {
  z-index: 90;
  max-width: calc(100vw - 1rem);
}

.sidebar-settings__popover--sidebar[data-collapsed='false'] {
  width: calc(var(--agent-chat-sidebar-current-width, var(--agent-chat-sidebar-width, 18rem)) - 1rem);
}

.chat-sidebar[data-sidebar-mode='gallery'] .sidebar-settings__trigger {
  width: min(100%, calc(var(--agent-chat-sidebar-width, 18rem) - 1rem));
}

.chat-sidebar[data-sidebar-mode='gallery'] .sidebar-settings__popover--sidebar[data-collapsed='false'] {
  width: calc(var(--agent-chat-sidebar-width, 18rem) - 1rem);
}

.sidebar-settings__popover--sidebar[data-collapsed='true'] {
  width: min(17rem, calc(100vw - 1rem));
}

.sidebar-settings__popover--drawer {
  width: min(22rem, calc(100vw - 2rem));
}

.sidebar-settings__menu {
  width: 100%;
  padding: 0.55rem;
  border-radius: 0.75rem;
  background: rgba(31, 20, 68, 0.54);
  border: 1px solid rgba(221, 214, 254, 0.18);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.sidebar-settings__identity {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.45rem 0.5rem 0.55rem;
  color: #ffffff;
}

.sidebar-settings__identity-icon,
.sidebar-settings__link-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.sidebar-settings__identity-icon {
  color: #c4b5fd;
}

.sidebar-settings__identity-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.83rem;
  font-weight: 700;
}

.sidebar-settings__rule {
  height: 1px;
  margin: 0.2rem 0.25rem 0.35rem;
  background: rgba(221, 214, 254, 0.18);
}

.sidebar-settings__links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-settings__link,
.sidebar-settings__notification-toggle,
.sidebar-settings__credits-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 2.25rem;
  padding: 0.5rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.82rem;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-settings__link:hover,
.sidebar-settings__notification-toggle:hover,
.sidebar-settings__credits-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-settings__link:focus-visible,
.sidebar-settings__notification-toggle:focus-visible,
.sidebar-settings__credits-trigger:focus-visible {
  outline: 2px solid rgba(221, 214, 254, 0.36);
  outline-offset: 1px;
}

.sidebar-settings__notification-toggle {
  justify-content: space-between;
  min-height: 2.8rem;
}

.sidebar-settings__notification-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
}

.sidebar-settings__notification-title {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
}

.sidebar-settings__notification-status {
  padding-left: 1.55rem;
  color: rgba(221, 214, 254, 0.76);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sidebar-settings__switch {
  position: relative;
  flex-shrink: 0;
  width: 2.2rem;
  height: 1.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.18s ease;
}

.sidebar-settings__switch[data-checked='true'] {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
}

.sidebar-settings__switch-thumb {
  position: absolute;
  top: 0.16rem;
  left: 0.16rem;
  width: 0.98rem;
  height: 0.98rem;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
  transition: transform 0.18s ease;
}

.sidebar-settings__switch[data-checked='true'] .sidebar-settings__switch-thumb {
  transform: translateX(0.9rem);
}

.sidebar-settings__credits {
  margin-top: 0.15rem;
}

.sidebar-settings__credits-trigger {
  justify-content: space-between;
}

.sidebar-settings__credits-title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.sidebar-settings__credits-chevron {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.sidebar-settings__credits-chevron[data-open='true'] {
  transform: rotate(180deg);
}

.sidebar-settings__credits-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.2rem 0 0;
  padding: 0.25rem 0.5rem 0.45rem;
}

.sidebar-settings__credits-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.75rem;
}

.sidebar-settings__credits-row dt,
.sidebar-settings__credits-row dd {
  margin: 0;
}

.sidebar-settings__credits-row dt {
  min-width: 0;
}

.sidebar-settings__credits-row dd {
  flex-shrink: 0;
  color: #ffffff;
  font-weight: 750;
}

.chat-sidebar--collapsed .chat-sidebar-section {
  overflow: visible;
}

.chat-sidebar--collapsed .chat-sidebar-section-header {
  display: none;
}

.chat-sidebar--collapsed .chat-sidebar-agent {
  justify-content: center;
  padding: 0.5rem 0.625rem;
  align-items: center;
}

.chat-sidebar--collapsed .chat-sidebar-agent-avatar {
  width: 2.375rem;
  height: 2.375rem;
}

.chat-sidebar--collapsed .chat-sidebar-agent-avatar-text {
  font-size: 0.75rem;
}

.chat-sidebar--collapsed .chat-sidebar-agent-meta {
  display: none;
}

.chat-sidebar--collapsed .chat-sidebar-agent-list {
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  overflow-y: auto;
}

.chat-sidebar--collapsed .chat-sidebar-agent-list::before,
.chat-sidebar--collapsed .chat-sidebar-agent-list::after {
  content: '';
  display: block;
  flex-shrink: 0;
  width: 100%;
  height: 0.5rem;
}

.chat-sidebar--collapsed .chat-sidebar-agent-empty {
  display: none;
}

.chat-sidebar-gallery-scroll {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  padding: 0 0.3rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.25) transparent;
  animation: sidebarGalleryEnter 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-sidebar-gallery-scroll::-webkit-scrollbar {
  width: 4px;
}

.chat-sidebar-gallery-scroll::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.25);
  border-radius: 999px;
}

.chat-sidebar-gallery-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 2.5rem;
  border: 1px dashed rgba(196, 181, 253, 0.35);
  border-radius: 0.875rem;
  background: rgba(167, 139, 250, 0.12);
  color: #ede9fe;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chat-sidebar-gallery-create:hover {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(196, 181, 253, 0.55);
  color: #ffffff;
}

.chat-sidebar-gallery-create:disabled,
.chat-sidebar-gallery-create[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.55;
}

.chat-sidebar-gallery-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.chat-sidebar-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14.5rem, 1fr));
  gap: 0.75rem;
}

.chat-sidebar-gallery-card,
.agent-drawer-gallery-card {
  position: relative;
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(196, 181, 253, 0.16);
  background: rgba(15, 23, 42, 0.82);
  color: rgba(248, 245, 255, 0.94);
  box-shadow: none;
}

.chat-sidebar-gallery-card[data-active='true'],
.agent-drawer-gallery-card[data-active='true'] {
  border-color: color-mix(in srgb, var(--agent-accent, #8b5cf6) 62%, white 18%);
}

.chat-sidebar-gallery-card[data-switching='true'],
.agent-drawer-gallery-card[data-switching='true'] {
  animation: sidebarGalleryCardPulse 1.3s ease-in-out infinite;
}

.chat-sidebar-gallery-card-top-actions,
.agent-drawer-gallery-card-top-actions {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-sidebar-gallery-card-favorite,
.agent-drawer-gallery-card-favorite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.26);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.chat-sidebar-gallery-card-favorite:hover,
.agent-drawer-gallery-card-favorite:hover {
  transform: scale(1.06);
}

.chat-sidebar-gallery-card-favorite[data-active='true'],
.agent-drawer-gallery-card-favorite[data-active='true'] {
  color: #fbbf24;
}

.chat-sidebar-gallery-card-icon-action,
.agent-drawer-gallery-card-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.chat-sidebar-gallery-card-icon-action {
  background: rgba(15, 23, 42, 0.26);
  color: rgba(255, 255, 255, 0.74);
}

.agent-drawer-gallery-card-icon-action {
  background: rgba(99, 102, 241, 0.12);
  color: #64748b;
}

.chat-sidebar-gallery-card-icon-action:hover,
.agent-drawer-gallery-card-icon-action:hover {
  transform: scale(1.06);
}

.chat-sidebar-gallery-card-button,
.agent-drawer-gallery-card-button {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 0.7rem;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.chat-sidebar-gallery-card-button:focus-visible,
.agent-drawer-gallery-card-button:focus-visible,
.chat-sidebar-gallery-card-favorite:focus-visible,
.agent-drawer-gallery-card-favorite:focus-visible,
.chat-sidebar-gallery-card-icon-action:focus-visible,
.agent-drawer-gallery-card-icon-action:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.5);
  outline-offset: 2px;
}

.chat-sidebar-gallery-card-hero,
.agent-drawer-gallery-card-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem;
  min-height: 5.6rem;
  padding: 1rem 1rem 0.8rem;
  overflow: hidden;
}

.chat-sidebar-gallery-card-hero,
.agent-drawer-gallery-card-hero {
  background: rgba(30, 41, 59, 0.88);
}

.chat-sidebar-gallery-card-hero-glow {
  position: absolute;
  inset: 0;
  background: none;
  pointer-events: none;
}

.chat-sidebar-gallery-card-avatar,
.agent-drawer-gallery-card-avatar {
  position: relative;
  z-index: 1;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.chat-sidebar-gallery-card-avatar-image,
.agent-drawer-gallery-card-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-sidebar-gallery-card-avatar-text,
.agent-drawer-gallery-card-avatar-text {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.chat-sidebar-gallery-card-hero-meta,
.agent-drawer-gallery-card-hero-meta {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 0.18rem;
}

.chat-sidebar-gallery-card-name,
.agent-drawer-gallery-card-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 700;
}

.chat-sidebar-gallery-card-mini,
.agent-drawer-gallery-card-mini {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 600;
}

.chat-sidebar-gallery-card-mini {
  color: rgba(255, 255, 255, 0.72);
}

.agent-drawer-gallery-card-mini {
  color: rgba(255, 255, 255, 0.72);
}

.chat-sidebar-gallery-card-tags,
.agent-drawer-gallery-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.15rem;
}

.chat-sidebar-gallery-card-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  background: rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.agent-drawer-gallery-card .chat-sidebar-gallery-card-tag {
  background: rgba(15, 23, 42, 0.18);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.94);
}

.chat-sidebar-gallery-card-footer,
.agent-drawer-gallery-card-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  margin-top: auto;
  padding: 0.95rem 1rem 1rem;
}

.chat-sidebar-gallery-card-primary-action,
.agent-drawer-gallery-card-primary-action {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-height: 2.2rem;
  border-radius: 0.8rem;
  border: 1px solid transparent;
  padding: 0.55rem 0.9rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.chat-sidebar-gallery-card-primary-action {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

.agent-drawer-gallery-card-primary-action {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

.chat-sidebar-gallery-card-primary-action:hover,
.agent-drawer-gallery-card-primary-action:hover {
  filter: brightness(1.04);
}

.chat-sidebar-gallery-card-channel-row,
.agent-drawer-gallery-card-channel-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.chat-sidebar-gallery-card-channel-action,
.agent-drawer-gallery-card-channel-action {
  display: inline-flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.2rem;
  border-radius: 0.8rem;
  border: 1px solid transparent;
  padding: 0.55rem 0.8rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

.chat-sidebar-gallery-card-channel-action:hover,
.agent-drawer-gallery-card-channel-action:hover {
  filter: brightness(1.04);
}

.chat-sidebar-gallery-card-channel-action--email {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

.chat-sidebar-gallery-card-channel-action--sms {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

.chat-sidebar-gallery-card-channel-action--chat {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

.agent-drawer-gallery-card-channel-action--email {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

.agent-drawer-gallery-card-channel-action--sms {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

.agent-drawer-gallery-card-channel-action--chat {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

.chat-sidebar-gallery-card-channel-action:disabled,
.agent-drawer-gallery-card-channel-action:disabled {
  cursor: wait;
  opacity: 0.7;
}

@keyframes agent-switch-pulse {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: scale(1.04);
  }
}

.chat-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.625rem;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.chat-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.9);
}

.chat-sidebar-item:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.4);
  outline-offset: -2px;
}

.chat-sidebar-item--active {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
}

.chat-sidebar-item--active:hover {
  background: rgba(167, 139, 250, 0.18);
}

.chat-sidebar-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
}

.chat-sidebar-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-sidebar--collapsed .chat-sidebar-item {
  justify-content: center;
  padding: 0.625rem;
}

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

/* Adjust main content when sidebar is present */
.has-sidebar {
  padding-left: var(--agent-chat-sidebar-current-width, var(--agent-chat-sidebar-width, 18rem));
  transition: padding-left 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.has-sidebar--collapsed {
  padding-left: var(--agent-chat-sidebar-current-width, var(--agent-chat-sidebar-width-collapsed, 5rem));
}

@media (max-width: 767px) {
  .chat-sidebar {
    display: none;
  }

  .has-sidebar,
  .has-sidebar--collapsed {
    padding-left: 0;
  }
}

/* ==========================================================================
   Mobile Agent FAB & Drawer
   ========================================================================== */

.agent-fab {
  --_accent: var(--agent-fab-accent, #6366f1);
  position: fixed;
  right: 1.875rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--composer-height, 6.5rem) + 1.625rem);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: var(--_accent);
  color: white;
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.12),
    0 0 0 0 var(--_accent);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  animation: agent-fab-enter 0.4s ease 0.6s both;
}

@keyframes agent-fab-enter {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 767px) {
  .agent-fab {
    display: flex;
  }
}

.agent-fab:hover {
  transform: scale(1.08);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.18),
    0 0 0 3px color-mix(in srgb, var(--_accent) 30%, transparent);
}

.agent-fab:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.agent-fab-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--_accent);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.agent-fab-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-fab-avatar-text {
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
}

/* Small badge in the bottom-right showing the switch icon */
.agent-fab-switch-badge {
  position: absolute;
  bottom: -0.125rem;
  right: -0.125rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: #1e293b;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.agent-fab-switch-badge svg {
  width: 0.5625rem;
  height: 0.5625rem;
}

/* Mobile sheet */
/* Drawer search */
.agent-drawer-search {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.agent-drawer-search-icon {
  position: absolute;
  left: 1.25rem;
  width: 1rem;
  height: 1rem;
  color: #94a3b8;
  pointer-events: none;
}

.agent-drawer-search-input {
  width: 100%;
  height: 2.5rem;
  padding: 0 2.5rem;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 0.5rem;
  background: rgba(248, 250, 252, 0.6);
  font-size: 0.9375rem;
  color: #334155;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.agent-drawer-search-input::placeholder {
  color: #94a3b8;
}

.agent-drawer-search-input:focus {
  border-color: rgba(99, 102, 241, 0.4);
  background: white;
}

.agent-drawer-search-clear {
  position: absolute;
  right: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, background 0.15s ease;
}

.agent-drawer-search-clear:active {
  background: rgba(100, 116, 139, 0.15);
  color: #64748b;
}

.agent-drawer-sort-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem 0.65rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.14);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.03));
}

.agent-drawer-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 1rem 0.15rem;
  color: #64748b;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.agent-drawer-sort-toggle-button {
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #4c1d95;
  background: rgba(129, 140, 248, 0.16);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.agent-drawer-sort-toggle-button[data-active='true'] {
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.agent-drawer-sort-toggle-button:active {
  background: rgba(79, 70, 229, 0.88);
  color: #ffffff;
}

.agent-drawer-view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0 0.75rem 0.65rem;
}

.agent-drawer-view-toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: none;
  border-radius: 0.65rem;
  padding: 0.55rem 0.7rem;
  background: rgba(99, 102, 241, 0.08);
  color: #4338ca;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.agent-drawer-view-toggle-button[data-active='true'] {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #ffffff;
}

.agent-drawer-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.agent-drawer-gallery-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.25rem 0.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  animation: sidebarGalleryEnter 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.agent-drawer-shell-switcher {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0.75rem 0;
}

.agent-drawer-gallery-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.75rem;
  border: 1px dashed rgba(79, 70, 229, 0.24);
  border-radius: 0.9rem;
  background: rgba(99, 102, 241, 0.08);
  color: #4338ca;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.agent-drawer-gallery-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.agent-drawer-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14.5rem, 1fr));
  gap: 0.8rem;
}

@media (max-width: 560px) {
  .agent-drawer-gallery-grid {
    grid-template-columns: 1fr;
  }
}

.agent-drawer-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: 0;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 0.875rem;
  transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.agent-drawer-item:active {
  background: rgba(241, 245, 249, 0.9);
}

.agent-drawer-item[data-active='true'] {
  background: rgba(99, 102, 241, 0.08);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.12);
}

.agent-drawer-item[data-active='true'] .agent-drawer-item-avatar {
  box-shadow: 0 0 0 2.5px white, 0 0 0 5px var(--agent-accent, #6366f1);
}

.agent-drawer-item[data-active='true'] .agent-drawer-item-name {
  color: var(--agent-accent, #6366f1);
}

.agent-drawer-item[data-switching='true'] .agent-drawer-item-avatar {
  animation: drawer-avatar-pulse 1.2s ease-in-out infinite;
}

@keyframes drawer-avatar-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2.5px white, 0 0 0 5px var(--agent-accent, #6366f1);
  }
  50% {
    box-shadow: 0 0 0 2.5px white, 0 0 0 10px rgba(99, 102, 241, 0.15);
  }
}

.agent-drawer-item[data-enabled='false'] {
  opacity: 0.55;
}

.agent-drawer-item-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.agent-drawer-item-leading {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.agent-drawer-item-unread-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.72rem;
  flex: 0 0 0.72rem;
}

.agent-drawer-item-unread-dot {
  display: block;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  background: #2df6f5;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(45, 246, 245, 0.3);
}

.agent-drawer-item-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: var(--agent-accent, #6366f1);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: box-shadow 0.2s ease;
}

.agent-drawer-item-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-drawer-item-avatar-text {
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.agent-drawer-item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
  padding-top: 0.125rem;
}

.agent-drawer-item-trailing {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.45rem;
}

.agent-drawer-item-favorite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: none;
  border-radius: 0.55rem;
  background: rgba(99, 102, 241, 0.09);
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.agent-drawer-item-favorite[data-active='true'] {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
}

.agent-drawer-item-favorite:active {
  background: rgba(99, 102, 241, 0.16);
}

.agent-drawer-item-favorite:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.32);
  outline-offset: 1px;
}

.agent-drawer-item-name {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1e293b;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.agent-drawer-item-desc {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.agent-drawer-item[data-active='true'] .agent-drawer-item-desc {
  color: #475569;
}

.agent-drawer-item-state {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f97316;
}

.agent-drawer-item-check {
  width: 1.25rem;
  height: 1.25rem;
  color: #6366f1;
  flex-shrink: 0;
}

.agent-list-working {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
}

.agent-list-working__dots {
  --agent-list-working-dot-size: 5px;
  --agent-list-working-dot-gap: 3px;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--agent-list-working-dot-size);
  align-items: center;
  column-gap: var(--agent-list-working-dot-gap);
  flex: 0 0 auto;
  width: calc((var(--agent-list-working-dot-size) * 3) + (var(--agent-list-working-dot-gap) * 2));
  line-height: 0;
}

.agent-list-working__dot {
  display: block;
  flex: 0 0 auto;
  width: var(--agent-list-working-dot-size);
  height: var(--agent-list-working-dot-size);
  min-width: var(--agent-list-working-dot-size);
  min-height: var(--agent-list-working-dot-size);
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: agent-list-working-pulse 1.2s ease-in-out infinite;
  transform: translateZ(0);
}

.agent-list-working__dot:nth-child(2) {
  animation-delay: 0.16s;
}

.agent-list-working__dot:nth-child(3) {
  animation-delay: 0.32s;
}

.agent-list-working__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes agent-list-working-pulse {
  0%, 80%, 100% {
    opacity: 0.35;
  }
  40% {
    opacity: 0.95;
  }
}

.chat-sidebar-agent-working-badge {
  position: absolute;
  right: -0.15rem;
  bottom: -0.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.05rem;
  padding: 0 0.18rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
  pointer-events: none;
}

.chat-sidebar-agent-working-badge .agent-list-working {
  gap: 0;
}

.chat-sidebar-agent-working-badge .agent-list-working__dots {
  --agent-list-working-dot-size: 4px;
  --agent-list-working-dot-gap: 2px;
}

.chat-sidebar-agent-working-badge .agent-list-working__dot {
  width: var(--agent-list-working-dot-size);
  height: var(--agent-list-working-dot-size);
  min-width: var(--agent-list-working-dot-size);
  min-height: var(--agent-list-working-dot-size);
}

.chat-sidebar-gallery-card-current,
.agent-drawer-gallery-card-current {
  cursor: default;
}

@keyframes sidebarGalleryEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sidebarGalleryCardPulse {
  0%, 100% {
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.18);
  }
  50% {
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(196, 181, 253, 0.22);
  }
}

@media (prefers-reduced-motion: reduce) {
  .banner-shell,
  .agent-chat-main,
  .chat-sidebar,
  .agent-chat-page--framed .banner-shell,
  .agent-chat-page--framed .agent-chat-main,
  .chat-sidebar-gallery-scroll,
  .agent-drawer-gallery-scroll,
  .chat-sidebar-gallery-card,
  .agent-drawer-gallery-card {
    animation: none;
    transition: none;
  }
}

.agent-drawer-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #64748b;
}

.agent-mobile-sheet--sidebar .chat-context-switcher__trigger {
  border-color: rgba(167, 139, 250, 0.25);
  background: rgba(167, 139, 250, 0.12);
  color: #c4b5fd;
}

.agent-mobile-sheet--sidebar .chat-context-switcher__trigger:hover {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.4);
  color: #ddd6fe;
}

.agent-mobile-sheet--sidebar .chat-context-switcher__trigger:focus-visible {
  outline-color: rgba(167, 139, 250, 0.35);
}

.agent-mobile-sheet--sidebar .chat-context-switcher__menu {
  background: rgba(31, 20, 68, 0.88);
  border: 1px solid rgba(221, 214, 254, 0.18);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px) saturate(1.25);
}

.agent-mobile-sheet--sidebar .chat-context-switcher__heading {
  color: rgba(226, 232, 240, 0.58);
}

.agent-mobile-sheet--sidebar .chat-context-switcher__item {
  color: rgba(255, 255, 255, 0.88);
}

.agent-mobile-sheet--sidebar .chat-context-switcher__item:hover,
.agent-mobile-sheet--sidebar .chat-context-switcher__item[data-selected='true'],
.agent-mobile-sheet--sidebar .chat-context-switcher__item[data-focused='true'] {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.agent-mobile-sheet--sidebar .chat-context-switcher__item-role {
  color: rgba(226, 232, 240, 0.72);
}

.agent-mobile-sheet--sidebar .agent-drawer-search {
  border-bottom: 1px solid rgba(167, 139, 250, 0.14);
}

.agent-mobile-sheet--sidebar .agent-drawer-search-icon {
  color: rgba(196, 181, 253, 0.56);
}

.agent-mobile-sheet--sidebar .agent-drawer-search-input {
  border-color: rgba(196, 181, 253, 0.18);
  background: rgba(15, 23, 42, 0.22);
  color: rgba(255, 255, 255, 0.92);
}

.agent-mobile-sheet--sidebar .agent-drawer-search-input::placeholder {
  color: rgba(196, 181, 253, 0.44);
}

.agent-mobile-sheet--sidebar .agent-drawer-search-input:focus {
  border-color: rgba(196, 181, 253, 0.34);
  background: rgba(15, 23, 42, 0.34);
}

.agent-mobile-sheet--sidebar .agent-drawer-search-clear {
  color: rgba(196, 181, 253, 0.56);
}

.agent-mobile-sheet--sidebar .agent-drawer-search-clear:active {
  background: rgba(167, 139, 250, 0.16);
  color: #ddd6fe;
}

.agent-mobile-sheet--sidebar .agent-drawer-sort-toggle {
  border-bottom: 1px solid rgba(167, 139, 250, 0.14);
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.08), rgba(167, 139, 250, 0.02));
}

.agent-mobile-sheet--sidebar .agent-drawer-section-header {
  color: rgba(226, 232, 240, 0.52);
}

.agent-mobile-sheet--sidebar .agent-drawer-sort-toggle-button,
.agent-mobile-sheet--sidebar .agent-drawer-view-toggle-button {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(226, 232, 240, 0.84);
}

.agent-mobile-sheet--sidebar .agent-drawer-sort-toggle-button[data-active='true'],
.agent-mobile-sheet--sidebar .agent-drawer-view-toggle-button[data-active='true'] {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #ffffff;
}

.agent-mobile-sheet--sidebar .agent-drawer-sort-toggle-button:active,
.agent-mobile-sheet--sidebar .agent-drawer-view-toggle-button:active {
  background: rgba(124, 58, 237, 0.88);
  color: #ffffff;
}

.agent-mobile-sheet--sidebar .agent-drawer-gallery-create {
  border-color: rgba(196, 181, 253, 0.35);
  background: rgba(167, 139, 250, 0.12);
  color: #ede9fe;
}

.agent-mobile-sheet--sidebar .agent-drawer-item {
  color: rgba(255, 255, 255, 0.88);
}

.agent-mobile-sheet--sidebar .agent-drawer-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.agent-mobile-sheet--sidebar .agent-drawer-item[data-active='true'] {
  background: rgba(167, 139, 250, 0.12);
  box-shadow: inset 0 0 0 1px rgba(196, 181, 253, 0.16);
}

.agent-mobile-sheet--sidebar .agent-drawer-item[data-active='true'] .agent-drawer-item-avatar {
  box-shadow: 0 0 0 2.5px rgba(31, 20, 68, 0.94), 0 0 0 5px var(--agent-accent, #8b5cf6);
}

.agent-mobile-sheet--sidebar .agent-drawer-item[data-active='true'] .agent-drawer-item-name {
  color: #ffffff;
}

.agent-mobile-sheet--sidebar .agent-drawer-item-name {
  color: rgba(255, 255, 255, 0.94);
}

.agent-mobile-sheet--sidebar .agent-drawer-item-desc,
.agent-mobile-sheet--sidebar .agent-drawer-item[data-active='true'] .agent-drawer-item-desc,
.agent-mobile-sheet--sidebar .agent-drawer-empty {
  color: rgba(226, 232, 240, 0.66);
}

.agent-mobile-sheet--sidebar .agent-drawer-item-favorite {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(226, 232, 240, 0.72);
}

.agent-mobile-sheet--sidebar .agent-drawer-item-favorite[data-active='true'] {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.agent-mobile-sheet--sidebar .agent-drawer-item-favorite:active {
  background: rgba(167, 139, 250, 0.16);
}

.agent-mobile-sheet--sidebar .agent-drawer-item-check {
  color: #c4b5fd;
}

.agent-mobile-sheet--sidebar .agent-drawer-gallery-card {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(196, 181, 253, 0.16);
  color: rgba(255, 255, 255, 0.94);
}

.agent-mobile-sheet--sidebar .agent-drawer-gallery-card-favorite,
.agent-mobile-sheet--sidebar .agent-drawer-gallery-card-icon-action {
  background: rgba(15, 23, 42, 0.26);
  color: rgba(255, 255, 255, 0.74);
}

.agent-mobile-sheet--sidebar .agent-drawer-gallery-card-hero {
  background: rgba(30, 41, 59, 0.88);
}

.agent-mobile-sheet--sidebar .agent-drawer-gallery-card-avatar {
  border-color: rgba(255, 255, 255, 0.22);
}

.agent-mobile-sheet--sidebar .agent-drawer-gallery-card-mini {
  color: rgba(255, 255, 255, 0.72);
}

.agent-mobile-sheet--sidebar .agent-drawer-gallery-card .chat-sidebar-gallery-card-tag {
  background: rgba(15, 23, 42, 0.18);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.94);
}

.agent-mobile-sheet--sidebar .agent-drawer-gallery-card-primary-action,
.agent-mobile-sheet--sidebar .agent-drawer-gallery-card-channel-action--email,
.agent-mobile-sheet--sidebar .agent-drawer-gallery-card-channel-action--sms,
.agent-mobile-sheet--sidebar .agent-drawer-gallery-card-channel-action--chat {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

.agent-mobile-sheet--sidebar .sidebar-settings--drawer {
  background: linear-gradient(180deg, rgba(28, 15, 66, 0), rgba(28, 15, 66, 0.94) 32%, rgba(23, 13, 56, 0.98));
  border-top: 1px solid rgba(167, 139, 250, 0.12);
}

.agent-mobile-sheet--sidebar .sidebar-settings--drawer .sidebar-settings__trigger {
  border-color: rgba(167, 139, 250, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

.agent-mobile-sheet--sidebar .sidebar-settings--drawer .sidebar-settings__trigger:hover,
.agent-mobile-sheet--sidebar .sidebar-settings--drawer .sidebar-settings__trigger[data-open='true'] {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(196, 181, 253, 0.32);
  color: #ffffff;
}

/* ==========================================================================
   Agent Chat Settings Panel
   ========================================================================== */

.agent-settings-modal-body {
  padding-right: 0;
}

.agent-settings-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.agent-settings-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.agent-settings-section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}


.agent-settings-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
}

.agent-settings-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.agent-settings-status--alert {
  color: #92400e;
  background: rgba(245, 158, 11, 0.18);
}

.agent-settings-status--warning {
  color: #9a3412;
  background: rgba(251, 146, 60, 0.18);
}

.agent-settings-status--neutral {
  color: #1e3a8a;
  background: rgba(59, 130, 246, 0.12);
}

.agent-settings-helper {
  font-size: 0.75rem;
  color: #64748b;
}

.agent-settings-error {
  font-size: 0.75rem;
  color: #b91c1c;
}

.agent-settings-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem 1.25rem;
}

.agent-settings-metric-label {
  display: block;
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.15rem;
}

.agent-settings-metric-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
}

.agent-settings-reset {
  font-size: 0.75rem;
  color: #475569;
}

.agent-settings-slider {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.agent-settings-input-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1f2937;
}

.agent-settings-range {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.35), rgba(59, 130, 246, 0.5));
  appearance: none;
  outline: none;
}

.agent-settings-range::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #0ea5e9;
  border: 2px solid #ffffff;
  box-shadow: 0 6px 14px rgba(14, 165, 233, 0.35);
  cursor: pointer;
}

.agent-settings-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #0ea5e9;
  border: 2px solid #ffffff;
  box-shadow: 0 6px 14px rgba(14, 165, 233, 0.35);
  cursor: pointer;
}

.agent-settings-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.35), rgba(59, 130, 246, 0.5));
}

.agent-settings-slider-hint {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #475569;
}

.agent-settings-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agent-settings-input {
  flex: 1;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  color: #0f172a;
  background: #ffffff;
}

.agent-settings-input:focus {
  outline: 2px solid rgba(14, 165, 233, 0.4);
  outline-offset: 2px;
}

.agent-settings-input-suffix {
  font-size: 0.8rem;
  color: #475569;
}

.agent-settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.agent-settings-save {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.agent-settings-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.agent-settings-save:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.agent-settings-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}

.agent-settings-link:hover {
  text-decoration: underline;
}

.agent-settings-pack-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.agent-settings-pack-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.08);
}

.agent-settings-pack-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.agent-settings-pack-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
}

.agent-settings-pack-price {
  font-size: 0.72rem;
  color: #475569;
}

.agent-settings-pack-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.agent-settings-pack-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: #ffffff;
  color: #1d4ed8;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.agent-settings-pack-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.agent-settings-pack-button:not(:disabled):hover {
  background: rgba(37, 99, 235, 0.12);
}

.agent-settings-pack-qty {
  min-width: 2rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
}

/* Embedded billing inside the gallery shell */
.billing-screen--embedded {
  color-scheme: dark;
  color: rgba(248, 245, 255, 0.94);
  --console-card-surface: rgba(15, 23, 42, 0.82);
  --console-card-border: 1px solid rgba(196, 181, 253, 0.16);
  --console-card-radius: 1.1rem;
  --console-card-shadow: none;
  --console-card-backdrop-filter: none;
  --console-card-webkit-backdrop-filter: none;
}

.billing-screen--embedded .card {
  background: var(--console-card-surface);
}

.billing-screen--embedded .text-slate-900 {
  color: rgba(248, 245, 255, 0.96);
}

.billing-screen--embedded .text-slate-800 {
  color: rgba(240, 232, 255, 0.92);
}

.billing-screen--embedded .text-slate-700 {
  color: rgba(224, 213, 255, 0.82);
}

.billing-screen--embedded .text-slate-600,
.billing-screen--embedded .text-slate-500 {
  color: rgba(196, 181, 253, 0.74);
}

.billing-screen--embedded .text-blue-700 {
  color: rgba(196, 225, 255, 0.96);
}

.billing-screen--embedded .text-amber-800,
.billing-screen--embedded .text-amber-700 {
  color: rgba(253, 230, 138, 0.96);
}

.billing-screen--embedded .text-rose-700 {
  color: rgba(254, 205, 211, 0.96);
}

.billing-screen--embedded .bg-white {
  background: rgba(14, 11, 33, 0.74);
}

.billing-screen--embedded .bg-blue-50 {
  background: rgba(99, 102, 241, 0.18);
}

.billing-screen--embedded .bg-amber-50 {
  background: rgba(245, 158, 11, 0.14);
}

.billing-screen--embedded .bg-slate-900 {
  background: rgba(8, 7, 21, 0.8);
}

.billing-screen--embedded .border-slate-200,
.billing-screen--embedded .border-slate-300,
.billing-screen--embedded .border-t {
  border-color: rgba(196, 181, 253, 0.16);
}

.billing-screen--embedded .border-rose-200 {
  border-color: rgba(251, 113, 133, 0.26);
}

.billing-screen--embedded .border-amber-200 {
  border-color: rgba(251, 191, 36, 0.24);
}

.billing-screen--embedded .shadow-sm,
.billing-screen--embedded .shadow-lg {
  box-shadow: none;
}

.billing-screen--embedded input[type='number'],
.billing-screen--embedded textarea {
  background: rgba(14, 11, 33, 0.74);
  border-color: rgba(196, 181, 253, 0.18);
  color: rgba(248, 245, 255, 0.96);
}

.billing-screen--embedded input[type='number']::placeholder,
.billing-screen--embedded textarea::placeholder {
  color: rgba(196, 181, 253, 0.56);
}

.billing-screen--embedded input[type='radio'] {
  accent-color: #8b5cf6;
}

.billing-screen--embedded .billing-screen__floating-actions {
  border: 1px solid rgba(196, 181, 253, 0.18);
  background: rgba(8, 7, 21, 0.76);
  box-shadow: none;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Embedded profile inside the gallery shell */
.profile-screen {
  display: grid;
  gap: 1rem;
  width: 100%;
  color: #0f172a;
}

.profile-screen--embedded {
  color-scheme: dark;
  color: rgba(248, 245, 255, 0.94);
}

.profile-screen__header,
.profile-screen__section {
  border: 1px solid rgba(196, 181, 253, 0.16);
  background: rgba(15, 23, 42, 0.82);
  box-shadow: none;
}

.profile-screen__header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-radius: 1.1rem;
  padding: 1.1rem 1.2rem;
}

.profile-screen__title-icon,
.profile-screen__section-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 211, 252, 0.24);
  background: rgba(14, 165, 233, 0.13);
  color: rgba(186, 230, 253, 0.96);
}

.profile-screen__title-icon {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.85rem;
}

.profile-screen__eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(196, 181, 253, 0.72);
}

.profile-screen h1,
.profile-screen h2,
.profile-screen p {
  margin: 0;
}

.profile-screen h1 {
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  font-weight: 750;
  line-height: 1.1;
  color: rgba(248, 245, 255, 0.97);
}

.profile-screen__section {
  display: grid;
  gap: 1rem;
  border-radius: 1.1rem;
  padding: 1.1rem;
}

.profile-screen__section-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.profile-screen__section-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
}

.profile-screen h2 {
  font-size: 1rem;
  font-weight: 720;
  line-height: 1.25;
  color: rgba(248, 245, 255, 0.96);
}

.profile-screen__section-header p,
.profile-screen__muted {
  margin-top: 0.2rem;
  font-size: 0.86rem;
  line-height: 1.4;
  color: rgba(196, 181, 253, 0.74);
}

.profile-screen__form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.profile-screen__field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.profile-screen__field--wide {
  grid-column: 1 / -1;
}

.profile-screen__field span {
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(224, 213, 255, 0.86);
}

.profile-screen input,
.profile-screen select {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(196, 181, 253, 0.18);
  border-radius: 0.75rem;
  background: rgba(14, 11, 33, 0.74);
  color: rgba(248, 245, 255, 0.96);
  font-size: 0.93rem;
  line-height: 1.35;
  padding: 0.72rem 0.82rem;
  outline: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.profile-screen input::placeholder {
  color: rgba(196, 181, 253, 0.56);
}

.profile-screen input:focus,
.profile-screen select:focus {
  border-color: rgba(125, 211, 252, 0.54);
  background: rgba(20, 16, 45, 0.86);
}

.profile-screen__field em {
  font-style: normal;
  font-size: 0.78rem;
  color: rgba(254, 205, 211, 0.96);
}

.profile-screen__actions,
.profile-screen__status-row,
.profile-screen__button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.profile-screen__button,
.profile-screen__icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  font-size: 0.88rem;
  font-weight: 720;
  line-height: 1;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.profile-screen__button {
  min-height: 2.5rem;
  padding: 0.68rem 0.9rem;
}

.profile-screen__icon-button {
  width: 2.3rem;
  height: 2.3rem;
}

.profile-screen__button:disabled,
.profile-screen__icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.profile-screen__button--primary {
  border-color: rgba(125, 211, 252, 0.22);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.92), rgba(99, 102, 241, 0.92));
  color: #ffffff;
}

.profile-screen__button--secondary {
  border-color: rgba(196, 181, 253, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 245, 255, 0.94);
}

.profile-screen__icon-button--danger {
  border-color: rgba(251, 113, 133, 0.28);
  background: rgba(244, 63, 94, 0.12);
  color: rgba(254, 205, 211, 0.96);
}

.profile-screen__button:not(:disabled):hover,
.profile-screen__icon-button:not(:disabled):hover {
  transform: translateY(-1px);
}

.profile-screen__copy-row,
.profile-screen__inline-form,
.profile-screen__verify-form {
  display: grid;
  gap: 0.75rem;
}

.profile-screen__copy-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.profile-screen__inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.profile-screen__verify-form {
  grid-template-columns: minmax(0, 1fr);
}

.profile-screen__phone-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.profile-screen__phone-number {
  font-size: 0.98rem;
  font-weight: 720;
  color: rgba(248, 245, 255, 0.96);
  overflow-wrap: anywhere;
}

.profile-screen__status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.42rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 720;
}

.profile-screen__status--success {
  background: rgba(34, 197, 94, 0.13);
  color: rgba(187, 247, 208, 0.96);
}

.profile-screen__status--warning {
  background: rgba(245, 158, 11, 0.14);
  color: rgba(253, 230, 138, 0.96);
}

.profile-screen__feedback {
  font-size: 0.84rem;
  line-height: 1.4;
}

.profile-screen__feedback--success {
  color: rgba(187, 247, 208, 0.96);
}

.profile-screen__feedback--error {
  color: rgba(254, 205, 211, 0.96);
}

@media (max-width: 720px) {
  .profile-screen__form-grid,
  .profile-screen__copy-row,
  .profile-screen__inline-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-screen__button {
    width: 100%;
  }
}
