/* ==================== MESSAGE BUBBLES, AVATARS & ACTIONS ==================== */
.nav-token-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 330px;
  background: var(--bg-popover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 15px 16px;
  z-index: 1000;
  font-size: 12.5px;
  color: var(--text-main);
  animation: fadeInSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-token-popover.hidden {
  display: none !important;
}

.token-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
  color: #f8fafc;
}

.token-popover-title {
  font-size: 13px;
  letter-spacing: -0.2px;
}

.token-popover-fraction {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  font-size: 12px;
  color: var(--primary-light, #a78bfa);
}

.token-usage-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.token-usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #06b6d4);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.token-popover-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3.5px 0;
  font-size: 12px;
  color: #94a3b8;
}

.token-popover-row .token-row-value {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  color: #e2e8f0;
  font-weight: 500;
}

.token-popover-row.total-row {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-weight: 600;
}

.token-popover-row.total-row .total-val {
  color: #f8fafc;
  font-weight: 700;
}

.token-popover-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 12px 0 10px 0;
}

.token-popover-section-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.cost-dual-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cost-idr-badge {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
}

.token-popover-disclaimer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10px;
  line-height: 1.45;
  color: #64748b;
}

.token-popover-disclaimer p {
  margin: 0;
}

.rate-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
  margin-bottom: 6px;
}

/* 2-TIER CONTEXT WINDOW & TOKEN USAGE POPOVER ENHANCEMENTS */
.token-popover-section {
  padding: 2px 0;
}

.token-header-left {
  display: flex;
  align-items: center;
}

.token-popover-pct {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-green, #10b981);
}

.token-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 6px 8px;
}

.token-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.token-stat-label {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.token-stat-val {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  font-size: 11.5px;
  font-weight: 600;
  color: #f1f5f9;
}

.token-lifetime-total {
  font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan, #38bdf8);
}

.cache-val {
  color: var(--accent-green, #10b981) !important;
  font-weight: 600;
}

/* ==================== CONTEXT WARNING & HANDOVER BANNER ==================== */
.context-warning-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(217, 119, 6, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-top: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  color: #fef3c7;
  font-size: 12px;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.08);
  animation: fadeInSlideUp 0.25s ease;
}

.context-warning-banner.hidden {
  display: none !important;
}

.warning-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.warning-banner-text i {
  color: #f59e0b;
  font-size: 15px;
  flex-shrink: 0;
}

.btn-summarize-rollover {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0f172a;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-summarize-rollover:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
  filter: brightness(1.1);
}

/* ==================== HERO FRESH CHAT BUTTON ==================== */
.hero-fresh-chat-wrap {
  margin-bottom: 12px;
  animation: fadeInSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-fresh-chat-wrap.hidden {
  display: none !important;
}

.btn-hero-fresh-chat {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(56, 189, 248, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  padding: 14px 18px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2), 0 0 0 1px rgba(99, 102, 241, 0.2);
  animation: pulseGlow 2.5s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2), 0 0 0 1px rgba(99, 102, 241, 0.2);
  }
  50% {
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.38), 0 0 16px rgba(56, 189, 248, 0.3);
    border-color: rgba(99, 102, 241, 0.7);
  }
}

.btn-hero-fresh-chat:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(56, 189, 248, 0.25));
  border-color: rgba(99, 102, 241, 0.8);
}

.hero-fresh-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  font-size: 18px;
  flex-shrink: 0;
}

.hero-fresh-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-fresh-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.2px;
}

.hero-fresh-sub {
  font-size: 12px;
  color: #94a3b8;
}

.hero-fresh-arrow {
  color: #818cf8;
  font-size: 15px;
  transition: transform 0.2s ease;
}

.btn-hero-fresh-chat:hover .hero-fresh-arrow {
  transform: translateX(4px);
  color: #a5b4fc;
}

/* ==================== EXECUTIVE CONTEXT SUMMARY CARD ==================== */
.executive-summary-card {
  background: rgba(18, 20, 30, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.summary-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}

.summary-card-title i {
  color: #818cf8;
}

.btn-copy-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-summary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.summary-card-body {
  font-size: 13px;
  line-height: 1.55;
  color: #e2e8f0;
}

.nav-chevron {
  display: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* CHAT CONTAINER (RESPONSIVE & FLUID) */
.chat-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overflow-anchor: auto;
  overscroll-behavior-y: contain;
  padding: 16px 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  scrollbar-width: none; /* Hide default Firefox scrollbar */
  -ms-overflow-style: none; /* Hide default IE/Edge scrollbar */
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(to bottom, black calc(100% - 56px), transparent 100%);
}

.chat-container::-webkit-scrollbar {
  display: none !important; /* Hide default Chrome/Safari scrollbar */
  width: 0 !important;
  height: 0 !important;
  background: transparent;
}

/* ==================== GOOGLE AI STUDIO LANDING HOME HERO ==================== */
.home-hero-container {
  margin: auto;
  width: 100%;
  max-width: 1000px;
  text-align: center;
  padding: 24px 0 36px;
  box-sizing: border-box;
  animation: fadeInHero 0.28s ease-out;
}

@keyframes fadeInHero {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-header-section {
  margin-bottom: 24px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  color: #818CF8;
  border: 1px solid rgba(99, 102, 241, 0.25);
  margin-bottom: 14px;
  letter-spacing: 0.3px;
}

.hero-title {
  font-size: 27px;
  font-weight: 700;
  margin: 0 0 8px 0;
  letter-spacing: -0.6px;
  color: var(--text-main);
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 620px;
  margin: 0 auto;
}

/* 6 FLOATING WORKSPACE CARDS GRID (DESKTOP) */
.workspace-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: left;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  box-sizing: border-box;
}

.workspace-cards-grid.grid-cols-1 {
  display: flex !important;
  justify-content: center !important;
}
.workspace-cards-grid.grid-cols-1 .workspace-card {
  max-width: 600px !important;
  width: 100% !important;
}

.workspace-cards-grid.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr) !important;
  max-width: 1000px !important;
}

.workspace-cards-grid.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr) !important;
}

.workspace-cards-grid.grid-cols-4 {
  grid-template-columns: repeat(2, 1fr) !important;
  max-width: 1000px !important;
}

.workspace-cards-grid.grid-cols-5 {
  grid-template-columns: repeat(6, 1fr) !important;
}
.workspace-cards-grid.grid-cols-5 .workspace-card:nth-child(1),
.workspace-cards-grid.grid-cols-5 .workspace-card:nth-child(2),
.workspace-cards-grid.grid-cols-5 .workspace-card:nth-child(3) {
  grid-column: span 2 !important;
}
.workspace-cards-grid.grid-cols-5 .workspace-card:nth-child(4) {
  grid-column: 2 / span 2 !important;
}
.workspace-cards-grid.grid-cols-5 .workspace-card:nth-child(5) {
  grid-column: 4 / span 2 !important;
}

.workspace-cards-grid.grid-cols-6 {
  grid-template-columns: repeat(3, 1fr) !important;
}

.workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 145px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.workspace-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

.ws-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.ws-card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ws-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.ws-card-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-card-open-icon {
  font-size: 12px;
  color: var(--text-dim);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.workspace-card:hover .ws-card-open-icon {
  color: #818CF8;
  transform: translate(2px, -2px);
}

.ws-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}

.ws-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 10px;
  margin-top: auto;
}

.ws-card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  padding: 2.5px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
}

.ws-card-time {
  font-size: 10.5px;
  color: var(--text-dim);
}

/* ACTION CARD (+ NEW / VIEW ALL) */
.workspace-card.action-card {
  border: 1px dashed rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 145px;
}

.workspace-card.action-card:hover {
  border-color: rgba(99, 102, 241, 0.75);
  background: rgba(99, 102, 241, 0.09);
}

.ws-action-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.16);
  color: #818CF8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  margin-bottom: 2px;
}

.ws-action-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.ws-action-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  max-width: 220px;
}

@media (max-width: 1020px) {
  .workspace-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .workspace-cards-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    scroll-snap-type: none !important;
  }

  /* Show only top 3 cards on mobile */
  .workspace-cards-grid .workspace-card:nth-child(n+4) {
    display: none !important;
  }

  .workspace-card {
    flex: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: auto !important;
    padding: 10px 14px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
  }

  .ws-card-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 2px !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .ws-card-title-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  .ws-card-icon {
    width: 24px !important;
    height: 24px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
  }

  .ws-card-name {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: var(--text-main) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .ws-card-open-icon {
    font-size: 11px !important;
    color: var(--text-dim) !important;
    flex-shrink: 0 !important;
  }

  .ws-card-desc {
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 11.5px !important;
    color: var(--text-muted) !important;
    margin: 3px 0 6px 0 !important;
    line-height: 1.4 !important;
    max-width: 100% !important;
  }

  .ws-card-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-top: 4px !important;
    margin-top: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    width: 100% !important;
  }

  .ws-card-badges {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }

  .ws-pill-badge {
    padding: 2px 6px !important;
    font-size: 10.5px !important;
    border-radius: 5px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    white-space: nowrap !important;
  }

  .ws-card-time {
    font-size: 10.5px !important;
    color: var(--text-dim) !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .hero-title {
    font-size: 19px !important;
    margin-bottom: 4px !important;
  }
  .hero-subtitle {
    font-size: 11.5px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    margin-bottom: 12px !important;
  }
  .home-hero-container {
    padding: 10px 6px 14px !important;
  }
}

/* WELCOME SCREEN (LEGACY FALLBACK) */

.f-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.f-card h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.f-card p {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.45;
}

/* MESSAGES LIST (GOOGLE AI STUDIO FOCUSED READING COLUMN - 1000PX) */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 80px;
  width: 100%;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  min-width: 0;
}

.message-wrapper {
  display: flex;
  gap: 12px;
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  background: transparent !important;
  transition: border-color 0.4s ease;
}

.message-wrapper.user-msg {
  background: transparent !important;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: none;
}

.message-wrapper.ai-msg {
  background: transparent !important;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: none;
}

.message-wrapper:hover,
.message-wrapper.user-msg:hover,
.message-wrapper.ai-msg:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: transparent !important;
}

.message-avatar-inline {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
  margin-top: 1px;
}

.user-msg .message-avatar-inline {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  box-shadow: none;
}

.ai-msg .message-avatar-inline {
  background: var(--primary);
}

.message-body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1;
  box-sizing: border-box;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.message-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* BUBBLE ACTION BAR (CLEAN CANVAS: HIDDEN IDLE, FADE IN ON HOVER/ACTIVE INSIDE BORDER) */
.bubble-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.message-wrapper:hover .bubble-actions,
.message-wrapper:focus-within .bubble-actions,
.message-wrapper.is-active .bubble-actions {
  opacity: 1;
}

.message-wrapper.is-active {
  border-color: rgba(255, 255, 255, 0.14) !important;
}

.btn-bubble-copy,
.btn-bubble-podcast,
.btn-bubble-speak,
.btn-bubble-save-note,
.btn-bubble-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  outline: none;
}

.btn-bubble-copy:hover,
.btn-bubble-podcast:hover,
.btn-bubble-speak:hover,
.btn-bubble-save-note:hover,
.btn-bubble-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.icon-sparkle-rerun {
  display: block;
  width: 13.5px;
  height: 13.5px;
  fill: currentColor;
  flex-shrink: 0;
}

/* More Dropdown Wrapper & Popover */
.bubble-more-dropdown-wrap {
  position: relative;
  display: inline-flex;
}

.bubble-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 175px;
  background: #18191c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  z-index: 100;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: dropdownFadeIn 0.15s ease;
}

.bubble-dropdown-menu.hidden {
  display: none !important;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble-dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  color: #e2e8f0;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.12s ease;
  outline: none;
  white-space: nowrap;
}

.bubble-dropdown-menu .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.bubble-dropdown-menu .dropdown-item.item-delete-cascade {
  color: #f87171;
}

.bubble-dropdown-menu .dropdown-item.item-delete-cascade:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* Inline Edit Box */
.inline-edit-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.inline-edit-textarea {
  width: 100%;
  min-height: 70px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14));
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-bright, #fff);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.inline-edit-textarea:focus {
  border-color: var(--primary, #6366F1);
}

.inline-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-inline-cancel {
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #94a3b8);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-inline-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-inline-save {
  height: 30px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--primary, #6366F1);
  border: none;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-inline-save:hover {
  background: #4f46e5;
}

/* Chat Network Error Box (Clean Minimal Dark - Zero Neon) */
.chat-network-error-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 8px;
  color: #f87171;
  font-size: 12.5px;
}

.chat-network-error-box .error-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.btn-retry-stream {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 6px;
  height: 28px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-retry-stream:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #ffffff;
}

.message-content {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-main);
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow-y: clip;
  position: relative;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-bottom: 6px;
}

.message-content p {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  overflow-y: clip;
  line-height: 1.85;
  isolation: isolate;
}
.message-content p:last-child { margin-bottom: 0; }

.message-content h1, .message-content h2, .message-content h3 {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 18px;
  margin-bottom: 8px;
  color: #fff;
  font-weight: 700;
  overflow-y: clip;
}

.message-content hr {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 18px 0;
}

.message-content ul,
.message-content ol {
  margin: 0 0 12px 0;
  padding-left: 24px;
  box-sizing: border-box;
}

.message-content li {
  margin-bottom: 4px;
  line-height: 1.75;
  box-sizing: border-box;
  overflow-y: clip;
}

.message-content li > ul,
.message-content li > ol {
  margin-top: 4px;
  margin-bottom: 4px;
  padding-left: 20px;
}

.message-content blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid #0284c7;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #d4d4d4;
  font-style: normal;
  box-sizing: border-box;
}

.message-content blockquote blockquote {
  margin: 6px 0;
  padding-left: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-left-color: var(--accent-cyan);
}

.message-content blockquote p {
  margin-bottom: 6px;
}
.message-content blockquote p:last-child {
  margin-bottom: 0;
}

.message-content blockquote ul,
.message-content blockquote ol {
  padding-left: 20px;
  margin-bottom: 8px;
}

.message-content code:not(pre code) {
  font-family: var(--font-mono);
  background: rgba(30, 38, 60, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  color: #93c5fd;
}

/* KEYBOARD SHORTCUTS <kbd> */
kbd,
.message-content kbd,
.doc-reader-body kbd,
.thinking-content kbd,
.modal-body kbd {
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #444444;
  border-bottom: 2px solid #555555;
  background: #222222;
  font-family: var(--font-mono, monospace);
  font-size: 0.85em;
  color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  display: inline-block;
  line-height: 1.2;
  vertical-align: baseline;
  white-space: nowrap;
}





/* ==================== TURN 3: AT-MENTION AUTOCOMPLETE POPOVER ==================== */

.at-mention-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 14px;
  width: 380px;
  max-width: calc(100% - 28px);
  background: var(--bg-popover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
  animation: popoverSlideUp 0.15s ease-out;
}

.at-mention-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
  color: #a78bfa;
  white-space: nowrap;
}

.at-mention-hint {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  font-family: var(--font-mono, monospace);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.at-mention-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.at-mention-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
  gap: 8px;
  border: 1px solid transparent;
}

.at-mention-item:hover, .at-mention-item.selected {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.35);
}

.at-mention-item-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.at-mention-icon {
  color: #818cf8;
  font-size: 12px;
  flex-shrink: 0;
}

.at-mention-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.at-mention-item.selected .at-mention-title {
  color: #fff;
  font-weight: 600;
}

.at-mention-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.at-mention-scope-badge {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.at-mention-scope-badge.project {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.canvas-loading-spinner {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: absolute !important;
  inset: 0 !important;
  background: var(--bg-dark) !important;
  z-index: 40 !important;
  transition: opacity 0.18s ease !important;
}

.canvas-loading-spinner.hidden {
  display: none !important;
}

.ai-studio-spinner-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent-cyan, #38bdf8);
  border-right-color: var(--primary, #6366f1);
  animation: aiStudioSpin 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes aiStudioSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Silky Fade-In Animation for Loaded Chat & Hub Content */
.fade-in {
  animation: smoothContentFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes smoothContentFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

