/* Quick replies: saved answers as a grid of cards, with search and a scope filter. */
.qr-page .page-heading {
  align-items: center;
  margin-bottom: 22px;
}
.qr-page .page-heading h1 {
  margin: 0;
}

.qr-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.qr-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 340px;
  height: 37px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.qr-search:hover {
  border-color: color-mix(in srgb, var(--muted) 45%, var(--line));
}
.qr-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent);
}
.qr-search svg {
  flex: none;
  width: 15px;
  height: 15px;
}
/* The search box draws the field; the input inside is bare. */
.dashboard-page .qr-search input[type="search"],
html[data-theme="dark"] body:not(.widget-page) .qr-search input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
}
.qr-search input::-webkit-search-cancel-button {
  display: none;
}
.qr-search kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: opacity 0.16s var(--ease);
}
.qr-search:focus-within kbd {
  opacity: 0;
}
.qr-toolbar .dh-select {
  width: 150px;
}
.qr-toolbar .dh-select-trigger {
  min-height: 37px;
  padding: 8px 11px;
}
.qr-count {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}
.qr-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px 16px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
  animation: qr-in 0.38s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 28ms);
}
.qr-card[hidden] {
  display: none;
}
@keyframes qr-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
/* Flat hover: the border firms up and the card lifts a shade, no shadow or movement. */
.qr-card:hover {
  border-color: color-mix(in srgb, var(--ink) 18%, var(--line));
  background: color-mix(in srgb, var(--ink) 2.5%, var(--surface));
}
.qr-shortcut {
  align-self: flex-start;
  max-width: 100%;
  height: 24px;
  padding: 0 8px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue);
  font: 500 12.5px/24px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qr-shortcut span {
  opacity: 0.6;
}
.qr-card h3 {
  margin: 12px 0 0;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The reply, shaped like the message it becomes, cut at three lines. */
.qr-body {
  min-height: calc(3 * 1.5em + 18px);
  margin: 8px 0 14px;
  padding: 9px 12px;
  border-radius: 4px 12px 12px 12px;
  background: var(--soft);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.qr-body > span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
}
.qr-var {
  padding: 1px 3px;
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--blue);
  font: 500 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.qr-card footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.qr-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.qr-meta svg {
  flex: none;
  width: 14px;
  height: 14px;
}
.qr-ix {
  color: var(--blue);
}
.qr-edit {
  gap: 6px;
  margin-left: auto;
}
.qr-edit svg {
  width: 13px;
  height: 13px;
}
.qr-card:hover .qr-edit {
  border-color: color-mix(in srgb, var(--muted) 45%, var(--line));
}

.qr-none {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 56px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--text-sm);
}
.qr-none[hidden] {
  display: none;
}

@media (max-width: 720px) {
  .qr-toolbar {
    flex-wrap: wrap;
  }
  .qr-search {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .qr-card {
    animation: none;
    transition: none;
  }
}

/* Quick reply editor: the form on the left, what the customer sees on the right. */
.modal.qr-ed {
  width: min(880px, calc(100% - 28px));
}
.qr-ed #modal-body {
  padding: 0;
}
.qr-ed .modal-heading {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.qre-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  min-height: 0;
}
.qre-form {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 20px 24px 22px;
}
.qre-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}
.qre-row input:not(#_) {
  height: 40px;
  min-height: 40px;
}
.qre label.field > span,
.qre .qre-label {
  font-size: var(--text-sm);
  font-weight: 450;
}

/* The shortcut: a fixed slash inside the field, typed in mono like a command. */
.qre-slash {
  position: relative;
  display: flex;
  align-items: center;
}
.qre-slash b {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 1px;
  display: grid;
  place-items: center;
  width: 30px;
  border-right: 1px solid var(--line);
  border-radius: 9px 0 0 9px;
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  color: var(--blue);
  font: 600 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  pointer-events: none;
}
.qre-slash input:not(#_) {
  padding-left: 40px;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -0.01em;
}

/* The reply and its insert bar share one frame. */
.qre-text {
  display: grid;
  gap: 7px;
}
.qre-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.qre-box:focus-within {
  border-color: #7794e9;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}
.qre-box textarea:not(#_) {
  display: block;
  height: 132px;
  min-height: 0;
  padding: 11px 12px 6px;
  border: 0;
  border-radius: 10px 10px 0 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  line-height: 1.6;
  resize: none;
}
.qre-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 7%, transparent);
}
.qre-bar > span:first-child {
  margin: 0 4px;
  color: var(--muted);
  font-size: 12px;
}
.qre-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px 0 7px;
  border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 8%, transparent);
  color: color-mix(in srgb, var(--blue) 85%, var(--ink));
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.12s var(--ease);
}
.qre-chip svg {
  width: 13px;
  height: 13px;
}
.qre-chip:hover {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  background: color-mix(in srgb, var(--blue) 15%, transparent);
}
.qre-chip:active {
  transform: scale(0.96);
}
.qre-chip:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
.qre-count {
  margin-right: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.qre .ix-qr {
  gap: 7px;
}
.qre .ix-block {
  margin: 6px 0 0;
}
.qre-scope {
  max-width: 260px;
}

/* The preview. */
.qre-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px 20px 22px;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 3%, var(--surface));
}
.qre-side-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-weight: 450;
}
.qre-side-h small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.qre-chat {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  min-height: 300px;
  padding: 0 14px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.qre-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 -14px auto;
  padding: 11px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 7%, transparent);
  font-size: 12.5px;
  font-weight: 550;
}
.qre-top i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
.qre-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.qre-av {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 650;
}
.qre-who {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.qre-who > small {
  padding-left: 2px;
  color: var(--muted);
  font-size: 11.5px;
}
.qre-bubble {
  max-height: 260px;
  padding: 8px 14px;
  overflow: hidden;
  border-radius: var(--ck-radius) var(--ck-radius) var(--ck-radius) var(--ck-tail);
  background: var(--ck-recv);
  color: var(--ck-recv-ink);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  animation: qre-in 0.28s var(--ease) both;
}
@keyframes qre-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
.qre-bubble mark {
  border-bottom: 1.5px solid color-mix(in srgb, var(--blue) 60%, transparent);
  background: none;
  color: inherit;
}
.qre-bubble:empty::before {
  content: "Your reply shows here.";
  color: var(--muted);
}
.qre-ask {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  padding-left: 34px;
}
.qre-ask:empty {
  display: none;
}
.qre-pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--blue) 55%, var(--line));
  border-radius: 999px;
  color: color-mix(in srgb, var(--blue) 85%, var(--ink));
  font-size: 12.5px;
  font-weight: 550;
  animation: qre-in 0.3s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.qre-pill.is-other {
  border-style: dashed;
  border-color: var(--line);
  color: var(--muted);
  font-weight: 450;
}
.qre-range {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.qre-email {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 34px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12.5px;
}
.qre-email em {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11.5px;
  font-style: normal;
  font-weight: 600;
}
.qre-input {
  display: flex;
  align-items: center;
  height: 34px;
  margin-top: 2px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12.5px;
}
.qre-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
}
.qre-foot .grow {
  flex: 1;
}
/* Narrow screens: the preview goes under the form. */
@media (max-width: 760px) {
  .qre-main {
    grid-template-columns: 1fr;
  }
  .qre-row {
    grid-template-columns: 1fr;
  }
  .qre-side {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .qre-chat {
    min-height: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .qre-bubble,
  .qre-pill {
    animation: none;
  }
}
