* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

header {
  padding: 16px 20px;
  background: #1a1a2e;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
}

.header-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.header-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-controls input {
  padding: 4px 8px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #2a2a4a;
  color: #fff;
  width: 80px;
  font-size: 13px;
}

.header-controls input[type="text"] {
  width: 120px;
}

.header-controls select {
  padding: 4px 8px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #2a2a4a;
  color: #fff;
  font-size: 13px;
}

.load-btn {
  padding: 4px 10px;
  background: #4a9eff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.load-btn:hover {
  background: #3a8eef;
}

.load-btn:disabled {
  background: #666;
  cursor: not-allowed;
}

.brand-info {
  font-size: 12px;
  color: #aaa;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#newChatBtn {
  padding: 6px 14px;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

#newChatBtn:hover {
  background: #c73e54;
}

.quick-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.card:hover {
  border-color: #1a1a2e;
  background: #f8f8ff;
}

.card-icon {
  font-size: 24px;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.welcome-msg {
  text-align: center;
  color: #888;
  padding: 40px 20px;
  font-size: 14px;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.message.user {
  align-self: flex-end;
  background: #1a1a2e;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: #f0f0f5;
  color: #333;
  border-bottom-left-radius: 4px;
}

.message.assistant pre {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0;
}

.message.assistant code {
  background: #e0e0e8;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.message.assistant pre code {
  background: none;
  padding: 0;
}

.message.assistant table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 13px;
}

.message.assistant th,
.message.assistant td {
  border: 1px solid #ccc;
  padding: 6px 10px;
  text-align: left;
}

.message.assistant th {
  background: #e8e8f0;
}

.thinking {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  background: linear-gradient(110deg, #f0f0f5 8%, #fafaff 18%, #f0f0f5 33%);
  background-size: 200% 100%;
  animation: thinking-shimmer 2.4s linear infinite;
  box-shadow: 0 1px 4px rgba(79, 140, 255, 0.08);
}

@keyframes thinking-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.thinking-dots {
  display: flex;
  gap: 4px;
}

.thinking-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: bounce 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }
.thinking-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.thinking-text {
  font-size: 13px;
  color: #6b6b85;
  animation: thinking-pulse 2s ease-in-out infinite;
  transition: opacity 0.25s ease;
}

@keyframes thinking-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.message.error {
  align-self: center;
  background: #ffeef0;
  color: #d32f2f;
  border: 1px solid #f5c6cb;
  font-size: 13px;
}

.message.result-info {
  align-self: center;
  background: #e8f5e9;
  color: #2e7d32;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
}

.typing-indicator {
  align-self: flex-start;
  color: #888;
  font-size: 13px;
  padding: 8px 0;
}

.input-area {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #eee;
  background: #fafafa;
}

#messageInput {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  resize: none;
  font-family: inherit;
}

#messageInput:focus {
  outline: none;
  border-color: #1a1a2e;
}

#messageInput:disabled {
  background: #f0f0f0;
  cursor: not-allowed;
}

#sendBtn {
  padding: 10px 24px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  align-self: flex-end;
}

#sendBtn:hover {
  background: #2a2a4e;
}

#sendBtn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 6px 20px;
  background: #f0f0f0;
  font-size: 12px;
  color: #888;
  border-top: 1px solid #e0e0e0;
}


body.is-embedded header {
  display: none;
}
