/* Ask about FabricLoop — public website assistant widget */
:root {
  --ask-blue: #0066D6;
  --ask-ink: #001418;
  --ask-bg: #f7f6f4;
  --ask-white: #ffffff;
  --ask-muted: #6a8088;
  --ask-border: rgba(0, 20, 24, 0.12);
  --ask-font: Inter, system-ui, -apple-system, sans-serif;
}

#ask-fabricloop-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99990;
  font-family: var(--ask-font);
  color: var(--ask-ink);
  line-height: 1.45;
}

#ask-fabricloop-root *,
#ask-fabricloop-root *::before,
#ask-fabricloop-root *::after {
  box-sizing: border-box;
}

.ask-launcher {
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--ask-ink);
  color: var(--ask-white);
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 20, 24, 0.22);
  transition: transform 0.15s ease, background 0.15s ease;
}

.ask-launcher:hover {
  background: #0a2a30;
  transform: translateY(-1px);
}

.ask-panel {
  display: none;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 40px));
  background: var(--ask-white);
  border: 1px solid var(--ask-border);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 20, 24, 0.2);
  flex-direction: column;
  overflow: hidden;
}

.ask-panel.open {
  display: flex;
}

.ask-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ask-ink);
  color: var(--ask-white);
}

.ask-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.ask-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.ask-close {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.ask-messages {
  flex: 1;
  overflow: auto;
  padding: 14px 14px 8px;
  background: var(--ask-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ask-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  word-break: break-word;
}

.ask-msg.user {
  align-self: flex-end;
  background: var(--ask-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.ask-msg.assistant,
.ask-msg.human {
  align-self: flex-start;
  background: var(--ask-white);
  border: 1px solid var(--ask-border);
  border-bottom-left-radius: 4px;
  white-space: normal;
}

.ask-msg.human {
  border-color: rgba(0, 102, 214, 0.35);
}

.ask-msg-author {
  font-size: 11px;
  font-weight: 650;
  color: var(--ask-blue);
  margin: 0 0 4px;
  letter-spacing: 0.01em;
}

.ask-msg-body > :first-child {
  margin-top: 0;
}

.ask-msg-body > :last-child {
  margin-bottom: 0;
}

.ask-msg a {
  color: var(--ask-blue);
  text-decoration: underline;
}

.ask-msg.user a {
  color: inherit;
}

.ask-msg.thinking {
  color: var(--ask-muted);
  font-style: italic;
  white-space: pre-wrap;
}

.ask-msg-status {
  font-style: italic;
  color: var(--ask-muted);
  font-size: 13px;
}

.ask-msg .ask-md-h {
  margin: 0.65em 0 0.35em;
  font-weight: 650;
  line-height: 1.25;
}

.ask-msg .ask-md-h:first-child {
  margin-top: 0;
}

.ask-msg h1.ask-md-h { font-size: 1.05em; }
.ask-msg h2.ask-md-h { font-size: 1em; }
.ask-msg h3.ask-md-h { font-size: 0.95em; }

.ask-msg p {
  margin: 0.45em 0;
}

.ask-msg p:first-child {
  margin-top: 0;
}

.ask-msg p:last-child {
  margin-bottom: 0;
}

.ask-msg .ask-md-list {
  margin: 0.4em 0;
  padding-left: 1.2em;
}

.ask-msg .ask-md-list li {
  margin: 0.2em 0;
}

.ask-msg .ask-md-hr {
  border: 0;
  border-top: 1px solid var(--ask-border);
  margin: 0.7em 0;
}

.ask-msg .ask-md-table-wrap {
  overflow-x: auto;
  margin: 0.5em 0;
  -webkit-overflow-scrolling: touch;
}

.ask-msg .ask-md-table {
  border-collapse: collapse;
  width: max-content;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.35;
}

.ask-msg .ask-md-table th,
.ask-msg .ask-md-table td {
  border: 1px solid var(--ask-border);
  padding: 5px 7px;
  text-align: left;
  vertical-align: top;
}

.ask-msg .ask-md-table th {
  background: rgba(0, 20, 24, 0.04);
  font-weight: 650;
}

.ask-msg .ask-md-pre {
  margin: 0.45em 0;
  padding: 8px 10px;
  overflow-x: auto;
  background: rgba(0, 20, 24, 0.05);
  border-radius: 8px;
  font-size: 12px;
}

.ask-msg code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.ask-msg :not(pre) > code {
  padding: 0.1em 0.35em;
  background: rgba(0, 20, 24, 0.06);
  border-radius: 4px;
}

.ask-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
  background: var(--ask-bg);
}

.ask-chip {
  appearance: none;
  border: 1px solid var(--ask-border);
  background: var(--ask-white);
  color: var(--ask-ink);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ask-chip:hover {
  border-color: var(--ask-blue);
  color: var(--ask-blue);
}

.ask-composer {
  border-top: 1px solid var(--ask-border);
  padding: 10px 12px 12px;
  background: var(--ask-white);
}

.ask-composer-row {
  display: flex;
  gap: 8px;
}

.ask-composer textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 96px;
  border: 1px solid var(--ask-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
}

.ask-composer textarea:focus {
  outline: 2px solid rgba(0, 102, 214, 0.25);
  border-color: var(--ask-blue);
}

.ask-send {
  appearance: none;
  border: none;
  background: var(--ask-blue);
  color: #fff;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.ask-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ask-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.ask-disclosure {
  font-size: 11px;
  color: var(--ask-muted);
  margin: 0;
}

.ask-human-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ask-blue);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  padding: 0;
}

.ask-escalate {
  display: none;
  gap: 8px;
  margin-top: 8px;
}

.ask-escalate.open {
  display: flex;
}

.ask-escalate input {
  flex: 1;
  border: 1px solid var(--ask-border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}

.ask-escalate button {
  appearance: none;
  border: none;
  background: var(--ask-ink);
  color: #fff;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 480px) {
  #ask-fabricloop-root {
    right: 12px;
    bottom: 12px;
  }
}
