#chat-float-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #007bff;
  color: #fff;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  z-index: 99999999;
  transition: background 0.2s;
}

#chat-float-btn:hover {
  background: #0056b3;
}

#chat-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 350px;
  max-width: 95vw;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  z-index: 1002;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999999;
  transition: box-shadow 0.2s, opacity 0.2s;
}

#chat-popup.chat-popup-minimized {
  display: none;
}

#chat-popup-header {
  background: #007bff;
  color: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
}

#chat-popup-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  margin-left: 8px;
  cursor: pointer;
  padding: 0 4px;
}

#chat {
  max-width: 100%;
  margin: 0;
  border: none;
  display: flex;
  flex-direction: column;
  height: 400px;
}

#messages {
  padding: 10px;
  height: 320px;
  overflow-y: auto;
  background: #f8f9fa;
}

#chat-form {
  display: flex;
  border-top: 1px solid #eee;
  background: #fff;
}

#input {
  flex: 1;
  border: none;
  padding: 10px;
  font-size: 15px;
  outline: none;
}

#chat-form button {
  background: #007bff;
  color: #fff;
  border: none;
  padding: 0 18px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 0 0 8px 0;
  transition: background 0.2s;
}

#chat-form button:hover {
  background: #0056b3;
}

#chat {
  max-width: 600px;
  margin: auto;
  border: 1px solid #ddd;
  display: flex;
  flex-direction: column;
}

#messages {
  padding: 10px;
  height: 400px;
  overflow-y: auto;
}

.msg {
  display: flex;
  margin: 8px 0;
}

.msg.user {
  justify-content: flex-end;
}

.msg.ai {
  justify-content: flex-start;
}

.msg.user > .bubble {
  background: #dcf8c6;
  color: #222;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 16px;
  max-width: 80%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  font-size: 13px;
  word-break: break-word;
}

.msg.ai > .bubble {
  background: #f1f0f0;
  color: #222;
  border-radius: 18px 18px 18px 4px;
  padding: 10px 16px;
  max-width: 80%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  font-size: 13px;
  word-break: break-word;
}

.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
  font-size: 13px;
}

.beta-intro {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  max-width: 90%;
}

#char-count {
  font-size: 12px; 
  color: #888; 
  margin-top: 2px; 
  text-align: right;
  padding-right: 5px;
  line-height: 40px;
}

#token-usage {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f0f4ff;
  border-top: 1px solid #e0e7ff;
  font-size: 11px;
  color: #555;
  min-height: 0;
}

#token-usage:empty {
  display: none;
}

.token-usage-label {
  font-weight: 600;
  color: #007bff;
  white-space: nowrap;
}

.token-usage-bar {
  flex: 1;
  height: 5px;
  background: #d0d8f0;
  border-radius: 3px;
  overflow: hidden;
}

.token-usage-fill {
  height: 100%;
  background: #007bff;
  border-radius: 3px;
  transition: width 0.4s;
}

.token-usage-fill-exhausted {
  background: #dc3545;
}

.token-usage-exhausted {
  color: #dc3545;
}

.token-usage-numbers {
  white-space: nowrap;
  color: #666;
}
