html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#chat-window {
  width: 100%;
  height: 100%;
  background: white;
  position: relative;
  display: flex;
  flex-direction: column;
  font-family: Arial, sans-serif;
}

#chat-header {
  background: #4f46e5;
  color: white;
  display: flex;
  align-items: center;
  font-weight: 600;
  padding: 6px 8px;
}

.chat-header-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.chatbot-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #4f46e5;
  color: #fff;
  padding: 10px 8px !important;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.1;
}

.chatbot-panel-header h5 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
}

#chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  font-size: 14px;
}

.message {
  margin-bottom: 6px;
}

.message.user {
  text-align: right;
  color: #1f2937;
}

.user-message-text {
  display: inline-block;
  max-width: calc(100% - 32px);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.user-resend-btn {
  width: 22px;
  height: 22px;
  margin-left: 6px;
  border: 1px solid #93c5fd;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-resend-btn:hover {
  background: #dbeafe;
  border-color: #60a5fa;
}

.message.bot {
  text-align: left;
  color: #374151;
}

.crop-analysis-content {
  border-left: 3px solid #15803d;
  padding: 2px 0 2px 9px;
  white-space: normal;
}

.crop-analysis-answer {
  margin: 0 0 8px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.crop-analysis-facts {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 3px 8px;
  margin: 0 0 9px;
  font-size: 11px;
}

.crop-analysis-facts dt {
  color: #64748b;
  font-weight: 600;
}

.crop-analysis-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.crop-analysis-chart {
  display: grid;
  gap: 3px;
  padding-top: 7px;
  border-top: 1px solid #e2e8f0;
}

.crop-chart-heading {
  margin-bottom: 2px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.crop-chart-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 38px;
  gap: 6px;
  align-items: center;
  min-height: 15px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.crop-chart-row time {
  color: #475569;
}

.crop-chart-track {
  height: 8px;
  overflow: hidden;
  border-radius: 2px;
  background: #e2e8f0;
}

.crop-chart-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: #16834a;
}

.crop-chart-value {
  color: #334155;
  text-align: right;
}

.message.bot.processing-status {
  color: #475569;
}

.message.bot.done-status {
  color: #166534;
  font-weight: 700;
}

.status-done {
  color: #15803d;
}

.message.bot.question {
  color: #0f4c81;
  font-style: italic;
  font-weight: 600;
  background: #e0f2fe;
  border-left: 3px solid #0284c7;
  border-radius: 8px;
  padding: 8px 10px;
}

#chat-suggestions {
  padding: 8px;
  border-top: 1px solid #eee;
}

#chat-suggestions button {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
}

#chat-input {
  display: flex;
  align-items: flex-end;
  padding: 8px;
  border-top: 1px solid #eee;
  gap: 6px;
}

#chat-input textarea {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  resize: none;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  line-height: 1.35;
  box-sizing: border-box;
}

#clear-chat {
  width: 26px;
  height: 32px;
  padding: 0;
  border: 1px solid #dc2626;
  border-radius: 6px;
  background: #fee2e2;
  color: #b91c1c;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  flex: 0 0 auto;
  box-shadow: 0 1px 2px rgba(127, 29, 29, 0.14);
}

#clear-chat:hover {
  background: #fecaca;
  border-color: #b91c1c;
  color: #991b1b;
}

#send {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #2563eb;
  border-radius: 6px;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 2px 4px rgba(30, 64, 175, 0.24);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#send:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

#send svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.chat-modal.hidden {
  display: none;
}

.chat-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
}

.chat-modal-card {
  position: relative;
  z-index: 1;
  width: calc(100% - 32px);
  max-width: 320px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  padding: 16px;
}

.chat-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.chat-modal-text {
  font-size: 12px;
  line-height: 1.45;
  color: #475569;
  margin-bottom: 14px;
}

.chat-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.chat-modal-actions button {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

#clear-chat-cancel {
  background: #e2e8f0;
  color: #0f172a;
}

#clear-chat-confirm {
  background: #ef4444;
  color: #fff;
}

#clear-chat-cancel:hover {
  background: #cbd5e1;
}

#clear-chat-confirm:hover {
  background: #dc2626;
}