:root {
  --df-copilot-blue: #08a9e5;
  --df-copilot-blue-dark: #087eae;
  --df-copilot-ink: #102a3a;
  --df-copilot-muted: #617985;
  --df-copilot-line: #d9e8ef;
  --df-copilot-soft: #f3f8fb;
}

#df-copilot-launcher {
  position: fixed;
  z-index: 2147483000;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--df-copilot-blue), var(--df-copilot-blue-dark));
  box-shadow: 0 14px 34px rgba(5, 93, 132, .3);
  font: 700 15px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

#df-copilot-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(5, 93, 132, .36); }
#df-copilot-launcher:focus-visible { outline: 3px solid rgba(8, 169, 229, .3); outline-offset: 3px; }
#df-copilot-launcher svg, .df-copilot-brand-icon svg, .df-copilot-avatar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }

#df-copilot-layer { position: fixed; inset: 0; z-index: 2147483001; pointer-events: none; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
#df-copilot-layer.is-open { pointer-events: auto; }
.df-copilot-scrim { position: absolute; inset: 0; border: 0; background: rgba(8, 27, 39, .3); opacity: 0; transition: opacity .18s ease; }
#df-copilot-layer.is-open .df-copilot-scrim { opacity: 1; }

.df-copilot-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(460px, calc(100vw - 24px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  color: var(--df-copilot-ink);
  background: #fff;
  border: 1px solid rgba(185, 211, 223, .85);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(5, 36, 52, .28);
  transform: translateX(calc(100% + 36px));
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}

#df-copilot-layer.is-open .df-copilot-panel { transform: translateX(0); }
.df-copilot-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; border-bottom: 1px solid var(--df-copilot-line); background: rgba(255, 255, 255, .97); }
.df-copilot-brand { display: flex; align-items: center; gap: 11px; }
.df-copilot-brand-icon, .df-copilot-avatar { display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: linear-gradient(135deg, var(--df-copilot-blue), var(--df-copilot-blue-dark)); }
.df-copilot-brand-icon { width: 42px; height: 42px; border-radius: 14px; }
.df-copilot-brand strong, .df-copilot-brand small { display: block; }
.df-copilot-brand strong { font-size: 17px; }
.df-copilot-brand small { margin-top: 3px; color: var(--df-copilot-muted); font-size: 12px; font-weight: 600; }
.df-copilot-header-actions { display: flex; gap: 6px; }
.df-copilot-header-actions button { width: 38px; height: 38px; border: 0; border-radius: 12px; color: #45606d; background: var(--df-copilot-soft); font-size: 22px; cursor: pointer; }
.df-copilot-header-actions button:hover { color: var(--df-copilot-blue-dark); background: #e5f5fb; }

.df-copilot-body { overflow-y: auto; overscroll-behavior: contain; padding: 18px; background: linear-gradient(#f7fbfd 0, #fff 280px); }
.df-copilot-welcome { margin-bottom: 18px; }
.df-copilot-eyebrow { display: block; color: var(--df-copilot-blue-dark); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.df-copilot-welcome h2 { margin: 7px 0 5px; color: var(--df-copilot-ink); font-size: 25px; line-height: 1.15; }
.df-copilot-welcome p { margin: 0; color: var(--df-copilot-muted); font-size: 14px; line-height: 1.5; }
.df-copilot-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.df-copilot-overview button { min-width: 0; padding: 12px; text-align: left; border: 1px solid var(--df-copilot-line); border-radius: 15px; background: #fff; cursor: pointer; }
.df-copilot-overview span, .df-copilot-overview small, .df-copilot-overview strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.df-copilot-overview span { color: var(--df-copilot-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.df-copilot-overview strong { margin: 6px 0 4px; white-space: nowrap; font-size: 16px; }
.df-copilot-overview small { color: #79909b; white-space: nowrap; font-size: 10px; }

.df-copilot-messages { display: flex; flex-direction: column; gap: 13px; }
.df-copilot-message { display: flex; align-items: flex-start; gap: 9px; }
.df-copilot-message.is-user { justify-content: flex-end; }
.df-copilot-message.is-user > div { max-width: 82%; padding: 11px 14px; color: #fff; background: var(--df-copilot-blue-dark); border-radius: 16px 16px 4px 16px; font-size: 14px; line-height: 1.45; }
.df-copilot-avatar { width: 30px; height: 30px; border-radius: 10px; }
.df-copilot-avatar svg { width: 16px; height: 16px; }
.df-copilot-answer { min-width: 0; max-width: calc(100% - 39px); padding: 13px; border: 1px solid var(--df-copilot-line); border-radius: 4px 16px 16px; background: #fff; box-shadow: 0 5px 18px rgba(24, 69, 88, .06); }
.df-copilot-answer > p { margin: 0; font-size: 14px; line-height: 1.55; }
.df-copilot-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(86px, 1fr)); gap: 7px; margin-top: 11px; }
.df-copilot-facts > span { padding: 9px; border-radius: 10px; background: var(--df-copilot-soft); }
.df-copilot-facts small, .df-copilot-facts strong { display: block; }
.df-copilot-facts small { color: var(--df-copilot-muted); font-size: 10px; }
.df-copilot-facts strong { margin-top: 3px; font-size: 13px; }
.df-copilot-sources, .df-copilot-inline-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.df-copilot-sources a, .df-copilot-inline-actions button { padding: 7px 10px; border: 1px solid #bce4f4; border-radius: 10px; color: var(--df-copilot-blue-dark); background: #effaff; font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer; }
.df-copilot-feedback { display: flex; align-items: center; gap: 6px; margin-top: 11px; padding-top: 9px; border-top: 1px solid #edf3f6; color: var(--df-copilot-muted); font-size: 11px; }
.df-copilot-feedback button { padding: 3px 7px; border: 1px solid var(--df-copilot-line); border-radius: 7px; color: #536c78; background: #fff; cursor: pointer; }
.df-copilot-error { padding: 10px 12px; border: 1px solid #f1c5c5; border-radius: 12px; color: #9c2f2f; background: #fff5f5; font-size: 13px; }

.df-copilot-prompts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.df-copilot-prompts button { padding: 8px 11px; border: 1px solid var(--df-copilot-line); border-radius: 999px; color: #3c5866; background: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.df-copilot-prompts button:hover { color: var(--df-copilot-blue-dark); border-color: #9bd9ef; background: #f2fbfe; }

.df-copilot-action-form, .df-copilot-confirmation { padding: 14px; border: 1px solid #aedff1; border-radius: 16px; background: #f3fbfe; }
.df-copilot-action-title strong, .df-copilot-action-title span { display: block; }
.df-copilot-action-title span { margin: 3px 0 10px; color: var(--df-copilot-muted); font-size: 12px; }
.df-copilot-action-form label { display: block; margin-top: 9px; color: #334f5d; font-size: 12px; font-weight: 700; }
.df-copilot-action-form input, .df-copilot-action-form textarea { box-sizing: border-box; width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid #c9dfe8; border-radius: 10px; color: var(--df-copilot-ink); background: #fff; font: inherit; }
.df-copilot-action-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.df-copilot-action-buttons button { min-height: 36px; padding: 0 12px; border: 1px solid #b8d8e5; border-radius: 10px; color: #486570; background: #fff; font-size: 12px; font-weight: 800; cursor: pointer; }
.df-copilot-action-buttons button:last-child { border-color: var(--df-copilot-blue); color: #fff; background: var(--df-copilot-blue); }
.df-copilot-confirmation > strong { display: block; margin-top: 6px; font-size: 14px; line-height: 1.45; }
.df-copilot-confirmation > p { margin: 7px 0 0; color: var(--df-copilot-muted); font-size: 12px; }

.df-copilot-footer { padding: 12px 15px 13px; border-top: 1px solid var(--df-copilot-line); background: #fff; }
.df-copilot-composer { display: flex; align-items: flex-end; gap: 8px; padding: 7px 7px 7px 13px; border: 1px solid #cbdfe8; border-radius: 16px; background: #fff; box-shadow: 0 4px 14px rgba(16, 63, 82, .05); }
.df-copilot-composer:focus-within { border-color: var(--df-copilot-blue); box-shadow: 0 0 0 3px rgba(8, 169, 229, .1); }
.df-copilot-composer textarea { flex: 1; max-height: 92px; padding: 7px 0; resize: none; border: 0; outline: 0; color: var(--df-copilot-ink); background: transparent; font: 14px/1.4 inherit; }
.df-copilot-composer button { width: 38px; height: 38px; border: 0; border-radius: 12px; color: #fff; background: var(--df-copilot-blue); font-size: 19px; cursor: pointer; }
.df-copilot-footer > small { display: block; margin-top: 7px; color: #7b9099; font-size: 10px; line-height: 1.35; text-align: center; }
.df-copilot-panel.is-busy .df-copilot-brand-icon { animation: df-copilot-pulse 1s ease-in-out infinite; }
@keyframes df-copilot-pulse { 50% { transform: scale(.9); opacity: .65; } }

@media (max-width: 620px) {
  #df-copilot-launcher { right: 14px; bottom: 76px; width: 50px; min-height: 50px; padding: 0; justify-content: center; border-radius: 16px; }
  #df-copilot-launcher span { display: none; }
  .df-copilot-panel { inset: 0; width: 100%; border: 0; border-radius: 0; }
  .df-copilot-scrim { display: none; }
  .df-copilot-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .df-copilot-overview button:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  #df-copilot-launcher, .df-copilot-panel, .df-copilot-scrim { transition: none; }
  .df-copilot-panel.is-busy .df-copilot-brand-icon { animation: none; }
}
