
  #chat-launcher, .cb-window, #chat-handoff-overlay {
    --cb-card: #ffffff;
    --cb-border: #e2e2e2;
    --cb-muted: #f3f3f3;
    --cb-foreground: #1a1a1a;
    --cb-primary: #f40;
    --cb-primary-foreground: #ffffff;
  }

  /* ---------- Launcher ---------- */
  #chat-launcher {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  }

  #chat-launcher.cb-hidden { display: none; }

  .cb-options {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    transform-origin: bottom;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: scale(0.95) translateY(0.5rem);
    pointer-events: none;
  }

  #chat-launcher.expanded .cb-options {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
  }

  .cb-option-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-radius: 9999px;
    background: var(--cb-card);
    border: 1px solid var(--cb-border);
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    padding: 0.625rem 1.25rem 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cb-foreground);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease;
    position: relative;
  }

  .cb-option-btn:hover { background: var(--cb-muted); }

  .cb-option-btn.cb-unavailable {
    cursor: default;
    opacity: 0.55;
    background: var(--cb-muted);
  }

  .cb-option-btn.cb-unavailable:hover { background: var(--cb-muted); }

  .cb-option-btn.cb-unavailable svg,
  .cb-option-btn.cb-unavailable .cb-option-badge {
    filter: grayscale(1);
  }

  .cb-option-btn.cb-option-hidden { display: none; }

  .cb-option-btn svg {
    width: 1rem;
    height: 1rem;
    color: var(--cb-primary);
    fill: currentColor;
    flex-shrink: 0;
  }

  .cb-option-badge,
  .cb-window-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.6;
    border-radius: 0.25rem;
    color: var(--cb-primary-foreground);
    flex-shrink: 0;
  }

  .cb-option-badge {
    width: 1rem;
    background: var(--cb-primary);
  }

  .cb-option-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: #22c55e;
    margin-left: 0.25rem;
    display: none;
  }

  .cb-option-btn.cb-has-convo .cb-option-dot { display: inline-block; }

  .cb-option-unread,
  .cb-fab-unread {
    position: absolute;
    top: -0.375rem;
    right: -0.375rem;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.25rem;
    border-radius: 9999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.125rem;
    text-align: center;
    box-shadow: 0 0 0 2px var(--cb-card);
    display: none;
  }

  .cb-option-btn.cb-has-unread .cb-option-unread,
  .cb-fab.cb-has-unread .cb-fab-unread { display: block; }

  .cb-fab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 9999px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.16);
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    background: var(--cb-primary);
    color: var(--cb-primary-foreground);
    position: relative;
  }

  .cb-fab:hover { background: color-mix(in srgb, var(--cb-primary) 85%, black); }

  #chat-launcher.expanded .cb-fab {
    background: var(--cb-muted);
    color: var(--cb-foreground);
    border: 1px solid var(--cb-border);
  }

  #chat-launcher.expanded .cb-fab:hover { background: #e8e8e8; }

  .cb-fab svg { width: 1rem; height: 1rem; fill: currentColor; }

  /* ---------- ChatBase windows ---------- */
  .cb-window {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999000;
    width: 380px;
    height: min(640px, 80vh);
    max-width: calc(100vw - 1.5rem);
    background: var(--cb-card);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: cb-slide-up 0.25s ease-out;
  }

  .cb-window.cb-open { display: flex; }

  @keyframes cb-slide-up {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  .cb-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: var(--cb-primary);
    color: var(--cb-primary-foreground);
    font-weight: 600;
    font-size: 0.9375rem;
    flex-shrink: 0;
  }

  .cb-window-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .cb-window-badge {
    padding: 0 0.25rem;
    background: rgba(255,255,255,0.22);
  }

  .cb-window-minimize {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 9999px;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--cb-primary-foreground);
    transition: background-color 0.15s ease;
    flex-shrink: 0;
  }

  .cb-window-minimize:hover { background: rgba(255,255,255,0.28); }

  .cb-window-minimize svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

  .cb-window-frame {
    flex: 1;
    border: none;
    width: 100%;
    background: var(--cb-card);
  }

  @media (max-width: 480px) {
    .cb-window {
      width: calc(100vw - 1rem);
      height: calc(100vh - 6rem);
      right: 0.5rem;
      bottom: 0.5rem;
    }
    #chat-launcher { right: 1rem; bottom: 1rem; }
  }


  #chat-handoff-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    animation: cb-handoff-fade 0.3s ease-in-out;
  }

  #chat-handoff-overlay.active { display: flex; }

  .handoff-message-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: cb-handoff-slide 0.4s ease-out;
  }

  .handoff-message-box h3 {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: #333;
    font-weight: 600;
  }

  .handoff-message-box p {
    margin: 0 0 25px 0;
    font-size: 16px;
    color: #666;
    line-height: 1.5;
  }

  .handoff-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: cb-handoff-spin 1s linear infinite;
  }

  .handoff-progress {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 20px;
  }

  .handoff-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    animation: cb-handoff-progress 2s ease-in-out forwards;
    border-radius: 2px;
  }

  @keyframes cb-handoff-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes cb-handoff-slide { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
  @keyframes cb-handoff-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
  @keyframes cb-handoff-progress { 0% { width: 0%; } 50% { width: 70%; } 100% { width: 100%; } }

  .handoff-message-box.handoff-info h3 { color: var(--cb-foreground); }
  .handoff-message-box.handoff-info p { margin-bottom: 0; }

#chat-launcher *, .cb-window *, #chat-handoff-overlay * { box-sizing: border-box; }
#chat-launcher button, .cb-window button { font-family: inherit; text-transform: none; letter-spacing: normal; margin: 0; }
#chat-launcher button:focus-visible, .cb-window button:focus-visible { outline: 3px solid var(--cb-foreground); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { #chat-launcher *, .cb-window, #chat-handoff-overlay, #chat-handoff-overlay * { animation: none; transition: none; } }
