.cw-launcher {
  position: fixed; bottom: 22px; right: 22px; z-index: 1000;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-primary); color: var(--on-accent, #fff);
  border: none; cursor: grab;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
  touch-action: none; user-select: none;
}
.cw-launcher.dragging { cursor: grabbing; box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
.cw-launcher svg { width: 26px; height: 26px; pointer-events: none; }

.cw-panel {
  position: fixed; bottom: 90px; right: 22px; z-index: 1000;
  width: 360px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 130px);
  background: var(--surface); border: 1px solid var(--grid-line);
  border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.28);
  display: none; flex-direction: column; overflow: hidden;
  font-family: 'Inter', sans-serif;
}
.cw-panel.open { display: flex; }

.cw-header { cursor: grab; touch-action: none; }
.cw-header.dragging { cursor: grabbing; }

.cw-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--grid-line);
}
.cw-header .cw-title { font-weight: 600; font-size: 0.95rem; color: var(--text-primary); }
.cw-header .cw-sub { font-size: 0.72rem; color: var(--text-secondary); }
.cw-icon-btn {
  background: none; border: none; cursor: pointer; color: var(--text-secondary);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.cw-icon-btn:hover { background: var(--bg); color: var(--text-primary); }
.cw-icon-btn.active { color: var(--accent-primary); }
.cw-icon-btn svg { width: 18px; height: 18px; }

.cw-messages {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.cw-msg { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 0.88rem; line-height: 1.5; }
.cw-msg.user { align-self: flex-end; background: var(--accent-primary); color: var(--on-accent, #fff); border-bottom-right-radius: 3px; }
.cw-msg.bot { align-self: flex-start; background: var(--bg); color: var(--text-primary); border: 1px solid var(--grid-line); border-bottom-left-radius: 3px; }
.cw-msg.system { align-self: center; color: var(--text-secondary); font-size: 0.78rem; text-align: center; }
.cw-msg strong { color: var(--accent-secondary); }

.cw-attachments { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px; }
.cw-chip {
  display: flex; align-items: center; gap: 5px; background: var(--bg); border: 1px solid var(--grid-line);
  border-radius: 20px; padding: 4px 10px; font-size: 0.72rem; color: var(--text-primary);
}
.cw-chip button { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 0; display:flex; }
.cw-chip button svg { width: 12px; height: 12px; }

.cw-inputbar {
  border-top: 1px solid var(--grid-line); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.cw-input-row { display: flex; align-items: flex-end; gap: 6px; }
.cw-textarea {
  flex: 1; resize: none; border: 1px solid var(--grid-line); border-radius: 10px;
  padding: 8px 10px; font-family: 'Inter', sans-serif; font-size: 0.88rem;
  background: var(--bg); color: var(--text-primary); max-height: 90px; min-height: 38px;
}
.cw-textarea:focus { outline: 2px solid var(--accent-secondary); outline-offset: 1px; }
.cw-counter { font-size: 0.68rem; color: var(--text-secondary); text-align: right; padding-right: 2px; }
.cw-counter.warn { color: var(--error); }

.cw-send-btn {
  background: var(--accent-primary); color: var(--on-accent, #fff); border: none;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cw-send-btn:disabled { opacity: 0.4; cursor: default; }
.cw-send-btn svg { width: 17px; height: 17px; }

.cw-quota-line { font-size: 0.68rem; color: var(--text-secondary); padding: 0 2px; }
.cw-typing { display: flex; gap: 4px; align-self: flex-start; padding: 6px 12px; }
.cw-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-secondary); animation: cwBounce 1.1s infinite ease-in-out; }
.cw-typing span:nth-child(2) { animation-delay: 0.15s; }
.cw-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes cwBounce { 0%,80%,100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }

.cw-legal-line { font-size: 0.66rem; color: var(--text-secondary); text-align: center; padding: 4px 14px 8px; }
.cw-legal-line a { color: var(--accent-secondary); text-decoration: none; }
