

.agent-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: transform 200ms, box-shadow 200ms;
  z-index: 1000;
}

.agent-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,0,0,0.4);
}

.agent-trigger .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg);
}

.agent-trigger.open { display: none; }

.chat-glyph {
  width: 22px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 5px;
  position: relative;
  display: inline-block;
}

.chat-glyph::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: -6px;
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: skew(-18deg);
  background: inherit;
}

.chat-glyph.small {
  width: 16px;
  height: 13px;
  border-width: 1.5px;
}

.chat-glyph.small::after {
  left: 3px;
  bottom: -5px;
  width: 6px;
  height: 6px;
  border-left-width: 1.5px;
  border-bottom-width: 1.5px;
}


.agent-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 56px);
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--bg-2);
  display: none;
  flex-direction: column;
  z-index: 1001;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  overflow: hidden;
  font-family: var(--sans);
  font-size: 15px;
}

.agent-panel.open {
  display: flex;
  animation: agentSlideIn 300ms ease-out;
}

@keyframes agentSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}


.agent-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  flex-shrink: 0;
}

.agent-header .icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.agent-header .info {
  flex: 1;
}

.agent-header .info .title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.agent-header .info .sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.agent-header .close-btn {
  background: none;
  border: none;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px;
  font-size: 22px;
  line-height: 1;
  transition: color 200ms;
}

.agent-header .close-btn:hover { color: var(--ink); }


.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.agent-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: agentFadeIn 300ms ease-out;
}

@keyframes agentFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.agent-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.agent-msg .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
  margin-top: 2px;
}

.agent-msg.assistant .avatar {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.agent-msg.user .avatar {
  background: var(--bg-3);
  color: var(--ink-2);
  border: 1px solid var(--rule);
}

.agent-msg .bubble {
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 14px;
}

.agent-msg.assistant .bubble {
  background: var(--bg);
  color: var(--ink-2);
  border: 1px solid var(--rule);
  border-top-left-radius: 4px;
}

.agent-msg.user .bubble {
  background: var(--accent);
  color: #171411;
  border-top-right-radius: 4px;
}

.agent-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.agent-typing .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  animation: agentDot 1.4s ease-in-out infinite;
}

.agent-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.agent-typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes agentDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}


.agent-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.agent-quick button {
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 200ms;
  white-space: nowrap;
  min-height: 40px;
}

.agent-quick button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}


.agent-input {
  padding: 12px 16px;
  border-top: 1px solid var(--rule);
  background: var(--bg);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.agent-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--bg-2);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  max-height: 100px;
  transition: border-color 200ms;
}

.agent-input textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.agent-input textarea::placeholder {
  color: var(--ink-3);
}

.agent-input .send-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  color: #171411;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 200ms, opacity 200ms;
}

.agent-input .send-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.agent-input .send-btn:not(:disabled):hover {
  background: var(--accent-hover);
}


.agent-end-state {
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.agent-end-state .check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.agent-end-state h3 {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ink);
}

.agent-end-state p {
  font-size: 14px;
  color: var(--ink-2);
  max-width: 36ch;
  line-height: 1.5;
}

.agent-end-state .summary {
  margin-top: 8px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-3);
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  white-space: pre-wrap;
}

.agent-end-state .btn-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.agent-end-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.agent-final-cta {
  font-size: 13px;
  padding: 10px 18px;
}


@media (max-width: 480px) {
  .agent-trigger {
    bottom: 18px;
    right: 18px;
    width: 52px;
    height: 52px;
  }

  .agent-panel.open {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    max-width: 100%;
    border-radius: 0;
  }

  .agent-header {
    padding: 14px 16px;
  }

  .agent-header .info .sub {
    letter-spacing: 0.04em;
    line-height: 1.3;
  }

  .agent-messages {
    padding: 16px;
  }

  .agent-msg {
    max-width: 96%;
  }

  .agent-quick button {
    white-space: normal;
    text-align: left;
    flex: 1 1 100%;
  }

  .agent-end-state .btn-row,
  .agent-end-state .btn-row .btn {
    width: 100%;
  }

  .agent-end-state .btn-row .btn {
    justify-content: center;
  }
}


.agent-messages::-webkit-scrollbar { width: 4px; }
.agent-messages::-webkit-scrollbar-track { background: transparent; }
.agent-messages::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }
