.ag-chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #795b40;
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  font: 700 15px/1.1 Arial, sans-serif;
}

.ag-chat-launcher:hover {
  background: #604732;
}

.ag-chat-launcher[hidden] {
  display: none !important;
}

.ag-chat-panel {
  position: fixed;
  right: 18px;
  bottom: 76px;
  z-index: 2147483000;
  width: min(540px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 96px));
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(121, 91, 64, 0.32);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
  color: #2f2b27;
  font: 14px/1.45 Arial, sans-serif;
}

.ag-chat-panel.is-open {
  display: grid;
}

.ag-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #3a2c22;
  color: #fff;
}

.ag-chat-header strong {
  display: block;
  font-size: 16px;
}

.ag-chat-header span {
  display: block;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12.5px;
  line-height: 1.3;
}

.ag-chat-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
}

.ag-chat-messages {
  overflow-y: auto;
  padding: 16px;
  background: #f7f5f2;
}

.ag-chat-msg {
  max-width: 100%;
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 8px;
  white-space: pre-wrap;
  font-size: 14.5px;
  line-height: 1.5;
}

.ag-chat-msg.assistant {
  background: #fff;
  border: 1px solid #e2d8cf;
}

.ag-chat-msg.user {
  margin-left: auto;
  background: #faf8f5;
  border: 1px solid #ded2c7;
}

.ag-chat-intro {
  margin: 10px 0 2px;
}

.ag-chat-examples {
  display: grid;
  gap: 7px;
  margin: 0 0 2px;
  padding: 10px;
  border: 1px solid #e2d8cf;
  border-radius: 8px;
  background: #fff;
}

.ag-chat-example {
  width: 100%;
  border: 1px solid #d8c8ba;
  border-radius: 7px;
  background: #fffdfb;
  color: #3f3024;
  padding: 8px 9px;
  cursor: pointer;
  font: 12px/1.25 Arial, sans-serif;
  text-align: left;
}

.ag-chat-question-bank {
  margin: 12px 0 4px;
  padding: 10px;
  border: 1px solid #e2d8cf;
  border-radius: 8px;
  background: #fff;
}

.ag-chat-question-bank summary {
  cursor: pointer;
  color: #3a2c22;
  font-weight: 700;
  font-size: 12px;
}

.ag-chat-bank-body {
  margin-top: 10px;
}

.ag-chat-bank-title {
  margin-bottom: 8px;
  color: #5c4737;
  font-size: 12px;
  font-weight: 700;
}

.ag-chat-story-packs {
  margin: 12px 0 4px;
  padding: 10px;
  border: 1px solid #e2d8cf;
  border-radius: 8px;
  background: #fff;
}

.ag-chat-story-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.ag-chat-story {
  flex: 0 0 auto;
  min-height: 28px;
  border: 1px solid #d8c8ba;
  border-radius: 999px;
  background: #faf7f4;
  color: #5c4737;
  padding: 0 10px;
  cursor: pointer;
  font: 700 11px Arial, sans-serif;
}

.ag-chat-story[aria-pressed="true"] {
  border-color: #795b40;
  background: #795b40;
  color: #fff;
}

.ag-chat-story-list {
  display: grid;
  gap: 6px;
}

.ag-chat-story-question {
  width: 100%;
  border: 1px solid #e5dacf;
  border-radius: 7px;
  background: #fffdfb;
  color: #3a2c22;
  padding: 8px 9px;
  cursor: pointer;
  font: 12px/1.25 Arial, sans-serif;
  text-align: left;
}

.ag-chat-story-question:hover {
  border-color: #b79f8a;
  background: #f7f0ea;
}

.ag-chat-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 7px;
  scrollbar-width: thin;
}

.ag-chat-tab {
  flex: 0 0 auto;
  min-height: 28px;
  border: 1px solid #d8c8ba;
  border-radius: 999px;
  background: #faf7f4;
  color: #5c4737;
  padding: 0 10px;
  cursor: pointer;
  font: 700 11px Arial, sans-serif;
}

.ag-chat-tab[aria-pressed="true"] {
  border-color: #795b40;
  background: #795b40;
  color: #fff;
}

.ag-chat-question-list {
  display: grid;
  gap: 6px;
  max-height: 178px;
  overflow-y: auto;
  padding-right: 2px;
}

.ag-chat-question {
  width: 100%;
  border: 1px solid #e5dacf;
  border-radius: 7px;
  background: #fffdfb;
  color: #3a2c22;
  padding: 8px 9px;
  cursor: pointer;
  font: 12px/1.25 Arial, sans-serif;
  text-align: left;
}

.ag-chat-question:hover {
  border-color: #b79f8a;
  background: #f7f0ea;
}

.ag-chat-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.ag-chat-source {
  border-radius: 999px;
  background: #f1e8df;
  color: #5f4937;
  padding: 4px 7px;
  font-size: 11px;
  text-decoration: none;
  border: 1px solid transparent;
}

.ag-chat-sources a.ag-chat-source,
.ag-chat-sources a.ag-chat-source:link,
.ag-chat-sources a.ag-chat-source:visited {
  color: #5f4937;
  text-decoration: none;
}

.ag-chat-sources a.ag-chat-source:hover {
  color: #3a2c22;
  border-color: #c8b29f;
  background: #fff;
}

.ag-chat-followups {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #eadfd5;
}

.ag-chat-followups summary {
  color: #755b47;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ag-chat-followup-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.ag-chat-followup {
  width: 100%;
  border: 1px solid #e5dacf;
  border-radius: 7px;
  background: #fffdfb;
  color: #3f3024;
  padding: 7px 8px;
  cursor: pointer;
  font: 12px/1.25 Arial, sans-serif;
  text-align: left;
}

.ag-chat-followup:hover {
  border-color: #b79f8a;
  background: #fff;
}

.ag-chat-form {
  display: grid;
  grid-template-columns: 1fr 68px;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2d8cf;
  background: #fff;
}

.ag-chat-input {
  min-height: 42px;
  max-height: 82px;
  resize: vertical;
  border: 1px solid #d8c8ba;
  border-radius: 8px;
  padding: 10px;
  font: inherit;
}

.ag-chat-send {
  border: 0;
  border-radius: 8px;
  background: #795b40;
  color: #fff;
  padding: 0 12px;
  cursor: pointer;
  font: 700 14px Arial, sans-serif;
}

.ag-chat-send:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 640px) {
  .ag-chat-panel {
    inset: 12px;
    width: auto;
    height: auto;
  }
}
