/* The embedded chat (docs/embedd.md gap #2): the page a business frames on its website. It fills its frame —
   the iframe snippet's box, or embed.js's floating panel (full screen on a phone). */
html, body { height: 100%; margin: 0; }
body { overflow: hidden; background: var(--ag-systemBackground, #fff); }
.ag-chat { height: 100%; display: flex; flex-direction: column; background: var(--ag-systemBackground, #fff); }
.ag-widget-close {
  margin-left: 4px; border: 0; background: transparent; color: var(--ag-secondaryLabel, #8e8e93);
  font-size: 1.5rem; line-height: 1; padding: 2px 6px; cursor: pointer;
}
.ag-inputbar { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.ag-unavailable { font: 0.95rem -apple-system, system-ui, sans-serif; color: #6c6c70; text-align: center; padding: 24px 16px; }

.ag-widget-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--ag-separator, #e5e5ea);
  background: var(--ag-secondarySystemBackground, #f5f5f7);
}
.ag-widget-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: #5a5a60; color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.ag-widget-logo { width: 100%; height: 100%; object-fit: cover; display: block; }
.ag-widget-title { font-weight: 600; }
.ag-widget-by { margin-left: auto; font-size: 0.75rem; color: var(--ag-secondaryLabel, #8e8e93); display: inline-flex; align-items: center; gap: 4px; }
.ag-widget-by .ag-widget-mark { border-radius: 4px; flex: none; }
.ag-widget-by b { font-weight: 600; color: var(--ag-label, #1c1c1e); }

.ag-transcript {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  background: var(--ag-systemBackground, #fff);
}

.ag-msg { max-width: 86%; font-size: 0.95rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.ag-you {
  align-self: flex-end; background: var(--ag-blue, #007aff); color: #fff;
  padding: 9px 13px; border-radius: 16px 16px 4px 16px;
}
.ag-agent {
  align-self: flex-start; background: var(--ag-secondarySystemBackground, #f1f1f4);
  color: var(--ag-label, #1c1c1e); padding: 9px 13px; border-radius: 16px 16px 16px 4px;
}
.ag-outcome {
  align-self: center; max-width: 94%;
  background: rgba(52, 199, 89, 0.12); color: #1d7a3a;
  padding: 10px 14px; border-radius: 12px; font-size: 0.86rem;
}
.ag-outcome-head { font-weight: 600; text-align: center; }
.ag-outcome-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0 0; }
.ag-outcome-list dt { color: #2f6b43; opacity: 0.85; }
.ag-outcome-list dd { margin: 0; color: #143d22; }
.ag-error {
  align-self: flex-start; background: rgba(255, 59, 48, 0.1); color: #c22b22;
  padding: 9px 13px; border-radius: 16px;
}
.ag-typing { color: var(--ag-secondaryLabel, #8e8e93); letter-spacing: 0.15em; }

/* A rendered request lives in a card bubble, wider and with its own iOS look. */
.ag-card { align-self: stretch; max-width: 100%; min-width: 0; padding: 0; background: transparent; }
.ag-card > div { max-width: 100%; border-radius: 14px; overflow: hidden; border: 1px solid var(--ag-separator, #e5e5ea); background: var(--ag-systemBackground, #fff); }

.ag-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 12px 12px; }
.ag-chip {
  border: 1px solid var(--ag-blue, #007aff); color: var(--ag-blue, #007aff);
  background: transparent; border-radius: 100px; padding: 6px 12px;
  font-size: 0.82rem; cursor: pointer;
}
.ag-chip:hover { background: rgba(0, 122, 255, 0.08); }
.ag-chip:disabled { opacity: 0.4; cursor: default; }

.ag-inputbar {
  display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--ag-separator, #e5e5ea);
  background: var(--ag-secondarySystemBackground, #f5f5f7);
}
.ag-input {
  flex: 1; border: 1px solid var(--ag-separator, #d7d7dc); border-radius: 100px;
  padding: 10px 14px; font-size: 0.95rem; background: var(--ag-systemBackground, #fff);
  color: var(--ag-label, #1c1c1e);
}
.ag-input:focus { outline: none; border-color: var(--ag-blue, #007aff); }
.ag-send {
  border: none; background: var(--ag-blue, #007aff); color: #fff;
  border-radius: 100px; padding: 10px 18px; font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.ag-send:disabled { opacity: 0.45; cursor: default; }

@media (prefers-color-scheme: dark) {
  .ag-agent { background: #2c2c2e; color: #f2f2f7; }
  .ag-widget-head, .ag-inputbar { background: #1c1c1e; }
  html, body, .ag-chat { background: #000; }
  .ag-input { background: #2c2c2e; color: #f2f2f7; border-color: #3a3a3c; }
}
