/* Support desk + email center styles (agent: support). Scoped under .desk-*. */

/* Department + brand chips */
.desk-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.desk-dept-support { background: #dcf6fb; color: #0e7d90; }
.desk-dept-sales { background: #ffe3f0; color: #c2186b; }
.desk-dept-custom { background: #efe4ff; color: #6b34b8; }
.desk-dept-parties { background: #fff3d6; color: #8f5f1a; }
.desk-brand-afd { background: #ffe3f0; color: #c2186b; }
.desk-brand-hoopz { background: #ffeadb; color: #b35410; }
.desk-brand-happy { background: #efe4ff; color: #6b34b8; }

/* Ticket status pills not covered by core admin.css */
.desk-page .status.pending { background: #fff0da; color: #8f5f1a; }
.desk-page .status.answered { background: #e3f3ea; color: #24604a; }
.desk-page .status.closed { background: #eceae7; color: #6d6d70; }
/* Email status pills */
.desk-mail-sent { background: #e3f3ea; color: #24604a; }
.desk-mail-logged { background: #eceae7; color: #6d6d70; }
.desk-mail-failed { background: #f9e3e3; color: #873b3b; }

/* Priority */
.desk-prio { font-size: .78rem; font-weight: 800; }
.desk-prio-high { color: #b84545; }
.desk-prio-low { color: #9a938d; font-weight: 600; }

/* Filters */
.desk-filters { align-items: flex-end; }
.desk-filters .admin-field { flex: 1 1 140px; min-width: 130px; }
.desk-filters .desk-filter-q { flex: 2 1 200px; }
.desk-filter-actions { display: flex; gap: 6px; padding-bottom: 2px; }
.desk-result-count { font-size: .78rem; margin-bottom: 8px; }
.desk-counts { font-size: .75rem; }

/* Ticket detail */
.desk-detail-head { display: grid; gap: 14px; }
.desk-detail-title h2 { margin: 0 0 6px; font-size: 1.1rem; }
.desk-detail-sub { font-size: .82rem; margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.desk-ref-note { margin-top: 8px; font-size: .8rem; background: #efe4ff; color: #6b34b8; border-radius: 10px; padding: 8px 10px; display: inline-block; }
.desk-meta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.desk-meta-row .admin-field { flex: 1 1 150px; min-width: 140px; }
.desk-meta-row select { width: 100%; }

/* Thread bubbles */
.desk-thread { display: grid; gap: 12px; }
.desk-msg {
  max-width: 85%;
  border: 1.5px solid #111;
  border-radius: 14px;
  padding: 10px 13px;
  background: #fff;
  box-shadow: 3px 3px 0 rgba(17, 201, 232, .12);
}
.desk-msg.desk-customer { justify-self: start; border-bottom-left-radius: 4px; }
.desk-msg.desk-staff { justify-self: end; background: #ffe9f4; border-bottom-right-radius: 4px; box-shadow: 3px 3px 0 rgba(255, 19, 133, .15); }
.desk-msg.desk-internal { background: #fff4dc; border-color: #b98a2e; box-shadow: 3px 3px 0 rgba(185, 138, 46, .18); }
.desk-internal-tag { font-size: .68rem; font-weight: 900; color: #8f5f1a; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.desk-msg.desk-system {
  justify-self: center;
  max-width: 100%;
  border: 0;
  box-shadow: none;
  background: transparent;
  text-align: center;
  color: #6d6d70;
  font-size: .76rem;
  padding: 2px 8px;
}
.desk-msg-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 5px; font-size: .8rem; }
.desk-msg-head small { color: #6d6d70; font-size: .7rem; }
.desk-msg-body { font-size: .88rem; line-height: 1.55; word-break: break-word; }
.desk-msg-body p { margin: 0 0 .55em; }
.desk-msg-body p:last-child { margin-bottom: 0; }
.desk-msg-body ul, .desk-msg-body ol { padding-left: 1.4em; margin: .4em 0; }
.desk-msg-body a { color: #ff1385; }

/* Reply form */
.desk-reply-options { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.desk-check { display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700; min-height: 42px; }
.desk-check input { width: 18px; height: 18px; accent-color: #ff1385; }
.desk-reply-options .admin-field { flex: 1 1 200px; }

/* Email center */
.desk-outbox-notice { margin-bottom: 14px; }
.desk-compose { margin-bottom: 14px; }
.desk-compose-summary { cursor: pointer; list-style: none; }
.desk-compose-summary::-webkit-details-marker { display: none; }
.desk-compose-summary h2::before { content: '▸ '; }
.desk-compose[open] .desk-compose-summary h2::before { content: '▾ '; }
.desk-span { grid-column: 1 / -1; }
.desk-error-text { color: #b84545; font-size: .78rem; margin: 6px 0; word-break: break-word; }

/* Email preview modal */
.desk-email-modal .admin-modal-card { width: min(100%, 860px); }
.desk-email-subject { margin: 0; font-size: .95rem; word-break: break-word; }
.desk-email-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .82rem; margin-bottom: 10px; }
.desk-email-frame { width: 100%; height: 70vh; border: 1.5px solid #ddd7d4; border-radius: 10px; background: #fff; }
.desk-email-actions { margin: 12px 0 0; }

/* ===================== V2 ===================== */

/* SLA badges */
.desk-sla {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .02em;
  white-space: nowrap;
}
.desk-sla-overdue { background: #f9e3e3; color: #a12c2c; border: 1px solid #e4b6b6; }
.desk-sla-soon { background: #fff0da; color: #8f5f1a; border: 1px solid #ecd3a8; }
.desk-sla-ok { background: #e3f3ea; color: #24604a; border: 1px solid #bcdcc9; }
.desk-sla-neutral { background: #f2f0ed; color: #8a847e; border: 1px solid #e3dfdb; font-weight: 700; }

/* Tag chips + tags form */
.desk-tag-list, .desk-tags-row { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.desk-tags-row { margin-top: 8px; font-size: .8rem; }
.desk-tag {
  display: inline-flex;
  padding: 2px 9px;
  border-radius: 999px;
  background: #efe4ff;
  color: #6b34b8;
  font-size: .68rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
a.desk-tag:hover { background: #e2d0ff; }
.desk-tags-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.desk-tags-form input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 8px 11px;
  border: 1.5px solid #ddd7d4;
  border-radius: 10px;
  font-size: .82rem;
}
.desk-tags-form input:focus { outline: none; border-color: #ff2f92; }

/* CSAT stars */
.desk-csat { color: #f0a422; font-size: .9rem; letter-spacing: 1px; white-space: nowrap; }
.desk-csat-off { color: #ddd7d4; }
.desk-csat-box {
  margin-top: 10px;
  padding: 9px 12px;
  background: #fff8ec;
  border: 1px solid #f0e2c4;
  border-radius: 10px;
  font-size: .84rem;
}
.desk-csat-comment { margin-top: 5px; color: #6d6d70; font-style: italic; word-break: break-word; }

/* Canned picker (reply form) */
.desk-canned-picker { max-width: 420px; }
.desk-canned-picker select { width: 100%; }

/* Canned manager */
.desk-canned-manager { margin-top: 14px; }
.desk-canned-manager .desk-compose-summary { cursor: pointer; list-style: none; }
.desk-canned-manager .desk-compose-summary::-webkit-details-marker { display: none; }
.desk-canned-manager .desk-compose-summary h2::before { content: '▸ '; }
.desk-canned-manager[open] .desk-compose-summary h2::before { content: '▾ '; }
.desk-canned-cat { background: #dcf6fb; color: #0e7d90; }
.desk-canned-actions { white-space: nowrap; }
.desk-canned-actions .a-btn { margin: 2px 4px 2px 0; }
.desk-canned-form { margin-top: 14px; }
.desk-canned-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* KB suggestions panel */
.desk-suggest-list { display: grid; gap: 10px; }
.desk-suggest {
  border: 1.5px solid #cfe9f2;
  background: #f4fbfe;
  border-radius: 12px;
  padding: 10px 13px;
}
.desk-suggest-title { font-weight: 800; font-size: .88rem; margin-bottom: 4px; }
.desk-suggest-title .muted { font-weight: 600; font-size: .74rem; }
.desk-suggest-snippet { font-size: .8rem; line-height: 1.5; color: #4c4741; word-break: break-word; }
.desk-suggest-snippet mark { background: #ffe3f0; color: #c2186b; border-radius: 3px; padding: 0 2px; }
.desk-suggest-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* Bulk bar */
.desk-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #ffe9f4;
  border: 1.5px solid #ffb9d9;
  border-radius: 12px;
}
.desk-bulk-bar[hidden] { display: none; }
.desk-bulk-count { font-size: .82rem; font-weight: 800; color: #c2186b; min-height: 34px; display: inline-flex; align-items: center; }
.desk-bulk-bar .admin-field { flex: 1 1 150px; min-width: 130px; margin: 0; }
.desk-bulk-bar select { width: 100%; }
.desk-check-col { width: 34px; text-align: center; }
.desk-check-col input[type="checkbox"], .bulk-check { width: 17px; height: 17px; accent-color: #ff2f92; cursor: pointer; }

/* Mobile (admin is used on phones) */
@media (max-width: 640px) {
  .desk-detail-head { grid-template-columns: 1fr; }
  .desk-meta-row { flex-direction: column; }
  .desk-meta-row .admin-field { width: 100%; }
  .desk-filters .admin-field, .desk-filters .desk-filter-q { flex: 1 1 100%; }
  .desk-filter-actions { width: 100%; }
  .desk-filter-actions .a-btn { flex: 1; text-align: center; }
  .desk-msg { max-width: 96%; }
  .desk-reply-options { flex-direction: column; align-items: stretch; }
  .desk-email-frame { height: 60vh; }
  .desk-counts { display: none; }
  /* V2 mobile */
  .desk-bulk-bar { flex-direction: column; align-items: stretch; }
  .desk-bulk-bar .admin-field { width: 100%; }
  .desk-bulk-bar .a-btn { width: 100%; text-align: center; }
  .desk-tags-form input { flex: 1 1 100%; }
  .desk-canned-picker { max-width: none; }
  .desk-suggest-actions .a-btn { flex: 1; text-align: center; }
}