/* Kindred AI — widget styles. Brand: deep green #14231b, gold #d9b86a, cream panel.
   All classes are kai- prefixed; nothing here touches page styles.
   --kai-bottom lets a host page lift the launcher above a sticky bar (print site: 84px). */
:root { --kai-bottom: 18px; }
.kai-launcher {
  position: fixed; right: 18px; bottom: var(--kai-bottom); z-index: 9990;
  display: inline-flex; align-items: center; gap: 8px;
  background: #14231b; color: #f5edd8; border: 1px solid #d9b86a; border-radius: 999px;
  padding: 11px 18px; font: 600 15px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 8px 24px rgba(10, 20, 14, .35); cursor: pointer;
}
.kai-launcher:hover { background: #1c3226; }
.kai-launcher.off { display: none; }
.kai-launcher svg { color: #d9b86a; flex: none; }
.kai-badge {
  background: #d9b86a; color: #14231b; border-radius: 999px; min-width: 20px; height: 20px;
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.kai-panel {
  position: fixed; right: 18px; bottom: var(--kai-bottom); z-index: 9991;
  width: min(384px, calc(100vw - 24px)); max-height: min(620px, calc(100vh - 40px));
  display: none; flex-direction: column; overflow: hidden;
  background: #fdfaf2; color: #1d2a21; border: 1px solid #d8cdb2; border-radius: 16px;
  box-shadow: 0 18px 48px rgba(10, 20, 14, .4); font: 400 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.kai-panel.open { display: flex; }
.kai-head {
  background: #14231b; color: #f5edd8; padding: 13px 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.kai-head h3 { margin: 0; font-size: 17px; letter-spacing: .2px; }
.kai-sub { margin: 2px 0 0; font-size: 12px; color: #d9c9a8; }
.kai-close { background: none; border: 0; color: #f5edd8; font-size: 24px; line-height: 1; cursor: pointer; padding: 0 2px; }
.kai-notice { margin: 0; padding: 8px 16px; font-size: 12px; background: #f1e8cf; color: #5c5232; }
.kai-error { margin: 0; padding: 8px 16px; font-size: 13px; background: #fbe9e7; color: #7a241a; }
.kai-error a { color: inherit; }
.kai-view { padding: 14px 16px 16px; overflow-y: auto; }
.kai-lede { margin: 0 0 12px; }
.kai-flabel { display: block; font-size: 13px; font-weight: 600; margin: 0 0 10px; }
.kai-input {
  width: 100%; box-sizing: border-box; margin-top: 4px; padding: 9px 10px;
  border: 1px solid #b9ac8d; border-radius: 8px; background: #fff; color: #1d2a21;
  font: 400 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.kai-input:focus { outline: 2px solid #d9b86a; outline-offset: 1px; }
.kai-ferror { color: #8c2f22; font-size: 13px; margin: 4px 0 8px; }
.kai-btn {
  background: #14231b; color: #f5edd8; border: 1px solid #14231b; border-radius: 9px;
  padding: 10px 16px; font: 600 15px/1.2 system-ui, sans-serif; cursor: pointer; width: 100%;
}
.kai-btn:hover { background: #1c3226; }
.kai-btn:disabled { opacity: .55; cursor: wait; }
.kai-thread { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.kai-messages { padding: 14px 14px 6px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.kai-msg { max-width: 88%; }
.kai-msg.kai-visitor { align-self: flex-end; }
.kai-msg.kai-ai, .kai-msg.kai-agent { align-self: flex-start; }
.kai-msg.kai-system { align-self: center; max-width: 96%; }
.kai-who { display: block; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: #8a6d2f; margin: 0 0 3px 4px; }
.kai-bubble { padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.kai-visitor .kai-bubble { background: #14231b; color: #f5edd8; border-bottom-right-radius: 4px; }
.kai-ai .kai-bubble, .kai-agent .kai-bubble { background: #efe7d0; color: #1d2a21; border-bottom-left-radius: 4px; }
.kai-system .kai-bubble { background: #e4efdf; color: #274a24; font-size: 13.5px; text-align: center; }
.kai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 4px; }
.kai-chip {
  background: #fff; border: 1px solid #b9ac8d; color: #14231b; border-radius: 999px;
  padding: 6px 12px; font: 600 13px/1.2 system-ui, sans-serif; cursor: pointer;
}
.kai-chip:hover { border-color: #14231b; }
.kai-chip-support { background: #d9b86a; border-color: #d9b86a; }
.kai-compose { display: flex; gap: 8px; padding: 10px 14px 6px; }
.kai-compose .kai-input { margin-top: 0; flex: 1; }
.kai-compose .kai-btn { width: auto; }
.kai-end, .kai-linkback {
  background: none; border: 0; color: #5c5232; font: 600 13px system-ui, sans-serif;
  cursor: pointer; padding: 6px 14px 12px; align-self: center; text-decoration: underline;
}
.kai-support .kai-btn { margin-top: 2px; }
@media (max-width: 480px) {
  .kai-panel { right: 8px; left: 8px; width: auto; bottom: 8px; max-height: calc(100vh - 24px); }
  .kai-launcher { right: 12px; }
}
@media (prefers-color-scheme: dark) {
  .kai-panel { background: #1a241d; color: #eee7d2; border-color: #3d4a3f; }
  .kai-input { background: #10160f; color: #eee7d2; border-color: #4a5548; }
  .kai-ai .kai-bubble, .kai-agent .kai-bubble { background: #2a362b; color: #eee7d2; }
  .kai-chip { background: #223026; color: #eee7d2; border-color: #4a5548; }
  .kai-chip-support { background: #d9b86a; color: #14231b; }
  .kai-notice { background: #2c2a1c; color: #d9c9a8; }
}
