@import url("../../_cdn/vendor/fonts/tabler-icons.css");

/* ============================================
   HELPDESK DESIGN SYSTEM - SomVibe
   ============================================ */

:root {
  --hd-primary: var(--primary-color, var(--color-dois, #9f00ff));
  --hd-primary-light: var(--primary-color, var(--color-dois, #9f00ff));
  --hd-primary-dark: var(--color-quatro, #8400d6);
  --hd-primary-alpha: rgba(159, 0, 255, 0.12);
  --hd-primary-alpha-soft: rgba(159, 0, 255, 0.12);
  --hd-primary-alpha-strong: rgba(159, 0, 255, 0.28);

  --hd-success: var(--positive-color, #16a34a);
  --hd-success-alpha: rgba(22, 163, 74, 0.12);
  --hd-success-border: rgba(22, 163, 74, 0.28);
  --hd-success-ink: #0f6b3a;
  --hd-success-soft: rgba(22, 163, 74, 0.18);
  --hd-warning: var(--pending-color, #d97706);
  --hd-warning-alpha: rgba(217, 119, 6, 0.12);
  --hd-warning-border: rgba(217, 119, 6, 0.2);
  --hd-warning-ink: #7a4200;
  --hd-warning-soft: rgba(217, 119, 6, 0.2);
  --hd-danger: var(--negative-color, #dc2626);
  --hd-danger-dark: #b91c1c;
  --hd-danger-alpha: rgba(220, 38, 38, 0.12);
  --hd-info: #0e96e5;
  --hd-info-alpha: rgba(14, 150, 229, 0.12);

  --hd-gray-50: #fbf7ff;
  --hd-gray-100: #f4ecff;
  --hd-gray-200: #e7daf5;
  --hd-gray-300: #d2bedf;
  --hd-gray-400: #b59fc5;
  --hd-gray-500: #8f789d;
  --hd-gray-600: #725e7f;
  --hd-gray-700: #594867;
  --hd-gray-800: #2f1f42;
  --hd-gray-900: #1c1127;

  --hd-bg: var(--surface-color, var(--color-um, #ffffff));
  --hd-bg-subtle: var(--surface-high-color, var(--color-tres, #f1f1f1));
  --hd-bg-muted: var(--surface-highest-color, var(--color-cinco, #f6f6f6));
  --hd-border: var(--input-border-color, var(--surface-border-color, var(--color-cinco, #eeeeee)));
  --hd-border-strong: var(--surface-border-color, var(--color-seis, #dddddd));

  --hd-text: var(--on-surface-color, rgba(80, 80, 80, 1));
  --hd-text-muted: var(--on-surface-variant-color, rgba(80, 80, 80, 0.86));
  --hd-text-subtle: var(--on-surface-variant-color, rgba(80, 80, 80, 0.62));
  --hd-text-on-primary: var(--on-primary-color, #ffffff);
  --hd-text-on-primary-muted: rgba(255, 255, 255, 0.82);
  --hd-text-on-primary-soft: rgba(255, 255, 255, 0.88);
  --hd-text-on-primary-subtle: rgba(255, 255, 255, 0.58);
  --hd-text-on-primary-faint: rgba(255, 255, 255, 0.42);

  --hd-radius-sm: 4px;
  --hd-radius: 8px;
  --hd-radius-md: 12px;
  --hd-radius-lg: 16px;
  --hd-radius-xl: 24px;
  --hd-radius-full: 9999px;

  --hd-shadow-xs: 0 1px 2px rgba(18, 2, 39, 0.06);
  --hd-shadow-sm: 0 2px 8px rgba(18, 2, 39, 0.09);
  --hd-shadow: 0 4px 16px rgba(18, 2, 39, 0.12);
  --hd-shadow-lg: 0 8px 32px rgba(18, 2, 39, 0.16);
  --hd-shadow-xl: 0 20px 48px rgba(18, 2, 39, 0.2);
  --hd-widget-pulse-shadow: 0 4px 16px rgba(159, 0, 255, 0.4);
  --hd-widget-pulse-shadow-strong: 0 4px 24px rgba(159, 0, 255, 0.7), 0 0 0 6px rgba(159, 0, 255, 0.12);
  --hd-notify-shadow: 0 10px 34px rgba(18, 2, 39, 0.42), 0 2px 8px rgba(18, 2, 39, 0.3);
  --hd-mobile-panel-shadow: 0 -20px 45px rgba(18, 2, 39, 0.24);

  --hd-sp-1: 4px;
  --hd-sp-2: 8px;
  --hd-sp-3: 12px;
  --hd-sp-4: 16px;
  --hd-sp-5: 20px;
  --hd-sp-6: 24px;
  --hd-sp-8: 32px;
  --hd-sp-10: 40px;
  --hd-sp-12: 48px;

  --hd-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --hd-text-xs: 0.75rem;
  --hd-text-sm: 0.875rem;
  --hd-text-base: 1rem;
  --hd-text-lg: 1.125rem;
  --hd-text-xl: 1.25rem;
  --hd-text-2xl: 1.5rem;
  --hd-text-3xl: 1.875rem;

  --hd-t-fast: 120ms ease;
  --hd-t-base: 220ms ease;
  --hd-t-slow: 350ms ease;

  --hd-z-dropdown: 100;
  --hd-z-sticky: 200;
  --hd-z-modal: 900;
  --hd-z-widget: 1000;
  --hd-z-toast: 1100;
  --hd-overlay: rgba(0, 0, 0, 0.45);
  --hd-overlay-soft: rgba(0, 0, 0, 0.15);
  --hd-overlay-on-primary: rgba(255, 255, 255, 0.16);
  --hd-overlay-on-primary-border: rgba(255, 255, 255, 0.28);
  --hd-overlay-on-primary-strong: rgba(255, 255, 255, 0.26);
  --hd-overlay-on-primary-bright: rgba(255, 255, 255, 0.3);
  --hd-overlay-on-primary-ghost: rgba(255, 255, 255, 0.08);
  --hd-wave-bg: rgba(18, 2, 39, 0.14);
  --hd-wave-stripe: rgba(18, 2, 39, 0.18);
  --hd-surface-inverse: var(--hd-gray-900);
  --hd-surface-inverse-border: rgba(255, 255, 255, 0.08);
  --hd-read-receipt: var(--hd-info);
  --hd-read-receipt-on-primary: rgba(255, 255, 255, 0.92);
  --hd-online: #4ade80;
  --hd-highlight: var(--hd-primary-alpha);
  --hd-select-caret-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23b59fc5' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  --hd-scrollbar-track: rgba(159, 0, 255, 0.08);
  --hd-scrollbar-thumb: rgba(159, 0, 255, 0.4);
  --hd-scrollbar-thumb-hover: rgba(159, 0, 255, 0.56);
}

body.dashboard_main {
  --hd-primary: var(--color-dois, #9f00ff);
  --hd-primary-light: var(--color-dois, #9f00ff);
  --hd-primary-dark: var(--color-quatro, #8400d6);
  --hd-primary-alpha: rgba(159, 0, 255, 0.12);

  --hd-bg: var(--color-um, #ffffff);
  --hd-bg-subtle: var(--color-tres, #f1f1f1);
  --hd-bg-muted: var(--background-color, #f6f6f6);
  --hd-border: var(--color-cinco, #eeeeee);
  --hd-border-strong: var(--color-seis, #dddddd);
  --hd-z-modal: 100600;
  --hd-z-widget: 100500;
  --hd-z-toast: 100700;
}

body:not(.dashboard_main) {
  --hd-bg: #ffffff;
  --hd-bg-subtle: #f7f3fb;
  --hd-bg-muted: #f2ecf8;
  --hd-border: #e9ddf4;
  --hd-border-strong: #d8cde8;

  --hd-text: #120227;
  --hd-text-muted: rgba(80, 80, 80, 0.92);
  --hd-text-subtle: rgba(80, 80, 80, 0.68);

  --hd-shadow-xs: 0 1px 2px rgba(18, 2, 39, 0.05);
  --hd-shadow-sm: 0 3px 10px rgba(18, 2, 39, 0.08);
  --hd-shadow: 0 8px 20px rgba(18, 2, 39, 0.1);
  --hd-shadow-lg: 0 12px 28px rgba(18, 2, 39, 0.12);
  --hd-shadow-xl: 0 22px 46px rgba(18, 2, 39, 0.16);
}

/* Client helpdesk page follows the active SomVibe theme (dark/light). */
body#main[data-theme="dark"] .hd-helpdesk-body,
body#main[data-theme="dark"] #hdNewTicketModal,
body#main[data-theme="dark"] #hdClientImagePreviewModal {
  --hd-bg: var(--surface-color, rgb(17, 2, 33));
  --hd-bg-subtle: var(--surface-high-color, rgb(31, 8, 55));
  --hd-bg-muted: var(--surface-highest-color, rgb(47, 14, 82));
  --hd-border: var(--input-border-color, var(--surface-border-color, rgba(241, 217, 255, 0.2)));
  --hd-border-strong: var(--surface-border-color, rgba(241, 217, 255, 0.2));
  --hd-text: var(--on-surface-color, #ffffff);
  --hd-text-muted: var(--on-surface-variant-color, rgb(155, 148, 159));
  --hd-text-subtle: rgba(255, 255, 255, 0.72);
  --hd-success-ink: #b8ffd5;
  --hd-success-soft: rgba(74, 222, 128, 0.22);
  --hd-warning-ink: #ffdca8;
  --hd-warning-soft: rgba(251, 191, 36, 0.24);
}

body#main[data-theme="white"] .hd-helpdesk-body,
body#main[data-theme="white"] #hdNewTicketModal,
body#main[data-theme="white"] #hdClientImagePreviewModal {
  --hd-bg: var(--surface-color, #ffffff);
  --hd-bg-subtle: var(--surface-high-color, #f1f1f1);
  --hd-bg-muted: var(--surface-highest-color, #f6f6f6);
  --hd-border: var(--input-border-color, var(--surface-border-color, #eeeeee));
  --hd-border-strong: var(--surface-border-color, #dddddd);
  --hd-text: var(--on-surface-color, #120227);
  --hd-text-muted: var(--on-surface-variant-color, rgba(18, 2, 39, 0.75));
  --hd-text-subtle: rgba(18, 2, 39, 0.62);
  --hd-success-ink: #0f6b3a;
  --hd-success-soft: rgba(22, 163, 74, 0.18);
  --hd-warning-ink: #7a4200;
  --hd-warning-soft: rgba(217, 119, 6, 0.2);
}

.hd-root,
.hd-page,
.hd-widget-panel,
.hd-modal,
.hd-toast,
.hd-card,
.hd-input,
.hd-widget-input,
.hd-table {
  font-family: var(--hd-font);
}
.hd-hidden {
  display: none !important;
}

.hd-helpdesk-content {
  display: block !important;
}

/* Scrollbar normalization (cliente + admin + widget + modais):
   evita barra preta padrão em alguns navegadores/OS. */
.hd-helpdesk-body,
.hd-admin-page,
.hd-widget-panel,
.hd-modal,
.hd-helpdesk-body *,
.hd-admin-page *,
.hd-widget-panel *,
.hd-modal * {
  scrollbar-width: thin;
  scrollbar-color: var(--hd-scrollbar-thumb) var(--hd-scrollbar-track);
}

.hd-helpdesk-body::-webkit-scrollbar,
.hd-admin-page::-webkit-scrollbar,
.hd-widget-panel::-webkit-scrollbar,
.hd-modal::-webkit-scrollbar,
.hd-helpdesk-body *::-webkit-scrollbar,
.hd-admin-page *::-webkit-scrollbar,
.hd-widget-panel *::-webkit-scrollbar,
.hd-modal *::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.hd-helpdesk-body::-webkit-scrollbar-track,
.hd-admin-page::-webkit-scrollbar-track,
.hd-widget-panel::-webkit-scrollbar-track,
.hd-modal::-webkit-scrollbar-track,
.hd-helpdesk-body *::-webkit-scrollbar-track,
.hd-admin-page *::-webkit-scrollbar-track,
.hd-widget-panel *::-webkit-scrollbar-track,
.hd-modal *::-webkit-scrollbar-track {
  background: var(--hd-scrollbar-track);
  border-radius: 999px;
}

.hd-helpdesk-body::-webkit-scrollbar-thumb,
.hd-admin-page::-webkit-scrollbar-thumb,
.hd-widget-panel::-webkit-scrollbar-thumb,
.hd-modal::-webkit-scrollbar-thumb,
.hd-helpdesk-body *::-webkit-scrollbar-thumb,
.hd-admin-page *::-webkit-scrollbar-thumb,
.hd-widget-panel *::-webkit-scrollbar-thumb,
.hd-modal *::-webkit-scrollbar-thumb {
  background: var(--hd-scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.hd-helpdesk-body::-webkit-scrollbar-thumb:hover,
.hd-admin-page::-webkit-scrollbar-thumb:hover,
.hd-widget-panel::-webkit-scrollbar-thumb:hover,
.hd-modal::-webkit-scrollbar-thumb:hover,
.hd-helpdesk-body *::-webkit-scrollbar-thumb:hover,
.hd-admin-page *::-webkit-scrollbar-thumb:hover,
.hd-widget-panel *::-webkit-scrollbar-thumb:hover,
.hd-modal *::-webkit-scrollbar-thumb:hover {
  background: var(--hd-scrollbar-thumb-hover);
  background-clip: padding-box;
}

.hd-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--hd-sp-1);
  padding: 3px 10px;
  border-radius: var(--hd-radius-full);
  font-size: var(--hd-text-xs);
  font-weight: 600;
}
.hd-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.hd-badge--open {
  background: var(--hd-info-alpha);
  color: var(--hd-info);
}
.hd-badge--active {
  background: var(--hd-warning-alpha);
  color: var(--hd-warning);
}
.hd-badge--waiting {
  background: var(--hd-primary-alpha);
  color: var(--hd-primary);
}
.hd-badge--resolved {
  background: var(--hd-success-alpha);
  color: var(--hd-success);
}
.hd-badge--closed {
  background: var(--hd-gray-100);
  color: var(--hd-gray-500);
}
.hd-badge--urgent {
  background: var(--hd-danger-alpha);
  color: var(--hd-danger);
}

.hd-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--hd-sp-2);
  padding: 9px 18px;
  border: none;
  border-radius: var(--hd-radius);
  font-size: var(--hd-text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--hd-t-base);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.hd-btn--primary {
  background: var(--hd-primary);
  color: var(--hd-text-on-primary);
}
.hd-btn--primary:hover {
  background: var(--hd-primary-dark);
  box-shadow: var(--hd-shadow-sm);
}
.hd-btn--secondary {
  background: var(--hd-bg-muted);
  color: var(--hd-text);
  border: 1px solid var(--hd-border);
}
.hd-btn--secondary:hover {
  background: var(--hd-gray-200);
}
.hd-btn--ghost {
  background: transparent;
  color: var(--hd-text-muted);
}
.hd-btn--ghost:hover {
  background: var(--hd-bg-muted);
  color: var(--hd-text);
}
.hd-btn--danger {
  background: var(--hd-danger-alpha);
  color: var(--hd-danger);
}
.hd-btn--sm {
  padding: 5px 12px;
  font-size: var(--hd-text-xs);
}
.hd-btn--lg {
  padding: 12px 24px;
  font-size: var(--hd-text-base);
}
.hd-btn--full {
  width: 100%;
  justify-content: center;
}
.hd-btn:active {
  transform: scale(0.97);
}
.hd-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hd-card {
  background: var(--hd-bg);
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius-md);
  box-shadow: var(--hd-shadow-sm);
  transition: box-shadow var(--hd-t-base);
}
.hd-card:hover {
  box-shadow: var(--hd-shadow);
}
.hd-card__header {
  padding: var(--hd-sp-5) var(--hd-sp-6);
  border-bottom: 1px solid var(--hd-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hd-card__title {
  font-size: var(--hd-text-base);
  font-weight: 700;
  color: var(--hd-text);
  margin: 0;
}
.hd-card__body {
  padding: var(--hd-sp-6);
}

.hd-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--hd-sp-2);
  padding: var(--hd-sp-5);
}
.hd-kpi__label {
  font-size: var(--hd-text-xs);
  font-weight: 600;
  color: var(--hd-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hd-kpi__value {
  font-size: var(--hd-text-3xl);
  font-weight: 800;
  color: var(--hd-text);
  line-height: 1;
}
.hd-kpi__meta {
  font-size: var(--hd-text-xs);
  color: var(--hd-text-subtle);
}
.hd-kpi__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--hd-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.hd-field {
  display: flex;
  flex-direction: column;
  gap: var(--hd-sp-1);
}
.hd-label {
  font-size: var(--hd-text-sm);
  font-weight: 600;
  color: var(--hd-text);
}
.hd-input {
  appearance: none;
  padding: 10px 14px;
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  background: var(--hd-bg);
  color: var(--hd-text);
  font: inherit;
  font-size: var(--hd-text-sm);
  transition: border-color var(--hd-t-fast), box-shadow var(--hd-t-fast);
  width: 100%;
}
.hd-input:focus {
  outline: none;
  border-color: var(--hd-primary);
  box-shadow: 0 0 0 3px var(--hd-primary-alpha);
}
.hd-input--error {
  border-color: var(--hd-danger);
}
.hd-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}
.hd-select {
  background-image: var(--hd-select-caret-icon);
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.hd-messages {
  display: flex;
  flex-direction: column;
  gap: var(--hd-sp-4);
  padding: var(--hd-sp-6);
  overflow-y: auto;
  flex: 1;
}
.hd-msg {
  display: flex;
  gap: var(--hd-sp-3);
  animation: hdSlideUp var(--hd-t-base);
}
.hd-msg--agent {
  justify-content: flex-start;
}
.hd-msg--client {
  justify-content: flex-end;
}
.hd-msg--system {
  justify-content: center;
}
.hd-msg__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.hd-msg__bubble {
  max-width: 72%;
  padding: 10px 16px;
  border-radius: var(--hd-radius-md);
  font-size: var(--hd-text-sm);
  line-height: 1.6;
  word-break: break-word;
  position: relative;
}
.hd-msg-reply-action {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: var(--hd-bg-subtle);
  color: var(--hd-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity var(--hd-t-fast), transform var(--hd-t-fast), background var(--hd-t-fast), color var(--hd-t-fast);
}
.hd-msg:hover .hd-msg-reply-action,
.hd-msg-reply-action:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.hd-msg-reply-action:hover {
  background: var(--hd-bg-muted);
  color: var(--hd-primary);
}
.hd-msg--client .hd-msg-reply-action {
  background: rgba(255, 255, 255, 0.2);
  color: var(--hd-text-on-primary);
}
.hd-msg--client .hd-msg-reply-action:hover {
  background: rgba(255, 255, 255, 0.28);
  color: var(--hd-text-on-primary);
}
.hd-msg-reply-quote {
  border-left: 3px solid var(--hd-primary);
  background: var(--hd-bg-subtle);
  border-radius: var(--hd-radius-sm);
  padding: 6px 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background var(--hd-t-fast), box-shadow var(--hd-t-fast);
}
.hd-msg-reply-quote:hover {
  background: rgba(122, 34, 255, 0.1);
}
.hd-msg-reply-quote:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(122, 34, 255, 0.32);
}
.hd-msg-reply-quote__label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--hd-text-muted);
}
.hd-msg-reply-quote__text {
  font-size: 12px;
  line-height: 1.35;
  color: var(--hd-text-subtle);
  margin-top: 2px;
}
.hd-msg-reply-body {
  margin-top: 4px;
}
.hd-msg--client .hd-msg-reply-quote {
  border-left-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.16);
}
.hd-msg--client .hd-msg-reply-quote:hover {
  background: rgba(255, 255, 255, 0.24);
}
.hd-msg--client .hd-msg-reply-quote__label,
.hd-msg--client .hd-msg-reply-quote__text {
  color: var(--hd-text-on-primary);
}
.hd-msg--reply-target .hd-msg__bubble {
  box-shadow: 0 0 0 2px rgba(122, 34, 255, 0.36), 0 12px 24px rgba(122, 34, 255, 0.18);
}
.hd-msg--agent .hd-msg__bubble {
  background: var(--hd-bg-muted);
  color: var(--hd-text);
  border-bottom-left-radius: var(--hd-radius-sm);
}
.hd-msg--client .hd-msg__bubble {
  background: var(--hd-primary);
  color: var(--hd-text-on-primary);
  border-bottom-right-radius: var(--hd-radius-sm);
}
.hd-msg--system .hd-msg__bubble {
  background: transparent;
  color: var(--hd-text-subtle);
  font-size: var(--hd-text-xs);
  font-style: italic;
}
.hd-msg__bubble a:not(.hd-msg-file) {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}
.hd-msg--agent .hd-msg__bubble a:not(.hd-msg-file) {
  color: var(--hd-text);
}
.hd-msg--client .hd-msg__bubble a:not(.hd-msg-file) {
  color: var(--hd-text-on-primary);
}
.hd-msg__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.hd-msg--has-receipt .hd-msg__meta {
  justify-content: flex-end;
}
.hd-msg__time {
  font-size: var(--hd-text-xs);
  color: var(--hd-text-subtle);
  margin-top: 0;
  display: inline-flex;
  align-items: center;
}
.hd-msg--client .hd-msg__time {
  text-align: right;
}
.hd-msg__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}
.hd-msg__status--sending,
.hd-msg__status--sent {
  color: var(--hd-text-subtle);
}
.hd-msg__status--received {
  color: var(--hd-text-muted);
}
.hd-msg__status--read {
  color: var(--hd-read-receipt);
}
.hd-msg--client .hd-msg__status--sending,
.hd-msg--client .hd-msg__status--sent,
.hd-msg--client .hd-msg__status--received {
  color: var(--hd-text-on-primary-muted);
}
.hd-msg--client .hd-msg__status--read {
  color: var(--hd-read-receipt-on-primary);
}
#hdWidgetMessages.hd-messages {
  gap: 0;
}
#hdWidgetMessages .hd-msg {
  margin-bottom: 10px;
}
#hdChatMessages.hd-messages,
#hdAdminMessages.hd-messages {
  gap: 0;
}
#hdChatMessages .hd-msg,
#hdAdminMessages .hd-msg {
  margin-bottom: 10px;
}
#hdWidgetMessages .hd-msg--group-start,
#hdWidgetMessages .hd-msg--group-mid {
  margin-bottom: 2px;
}
#hdChatMessages .hd-msg--group-start,
#hdChatMessages .hd-msg--group-mid,
#hdAdminMessages .hd-msg--group-start,
#hdAdminMessages .hd-msg--group-mid {
  margin-bottom: 2px;
}
#hdWidgetMessages .hd-msg--group-end,
#hdWidgetMessages .hd-msg--solo {
  margin-bottom: 10px;
}
#hdChatMessages .hd-msg--group-end,
#hdChatMessages .hd-msg--solo,
#hdAdminMessages .hd-msg--group-end,
#hdAdminMessages .hd-msg--solo {
  margin-bottom: 10px;
}
#hdWidgetMessages .hd-msg--agent.hd-msg--group-mid .hd-msg__bubble,
#hdWidgetMessages .hd-msg--agent.hd-msg--group-end .hd-msg__bubble {
  border-top-left-radius: var(--hd-radius-sm);
}
#hdChatMessages .hd-msg--agent.hd-msg--group-mid .hd-msg__bubble,
#hdChatMessages .hd-msg--agent.hd-msg--group-end .hd-msg__bubble,
#hdAdminMessages .hd-msg--agent.hd-msg--group-mid .hd-msg__bubble,
#hdAdminMessages .hd-msg--agent.hd-msg--group-end .hd-msg__bubble {
  border-top-left-radius: var(--hd-radius-sm);
}
#hdWidgetMessages .hd-msg--agent.hd-msg--group-start .hd-msg__bubble,
#hdWidgetMessages .hd-msg--agent.hd-msg--group-mid .hd-msg__bubble {
  border-bottom-left-radius: var(--hd-radius-sm);
}
#hdChatMessages .hd-msg--agent.hd-msg--group-start .hd-msg__bubble,
#hdChatMessages .hd-msg--agent.hd-msg--group-mid .hd-msg__bubble,
#hdAdminMessages .hd-msg--agent.hd-msg--group-start .hd-msg__bubble,
#hdAdminMessages .hd-msg--agent.hd-msg--group-mid .hd-msg__bubble {
  border-bottom-left-radius: var(--hd-radius-sm);
}
#hdWidgetMessages .hd-msg--client.hd-msg--group-mid .hd-msg__bubble,
#hdWidgetMessages .hd-msg--client.hd-msg--group-end .hd-msg__bubble {
  border-top-right-radius: var(--hd-radius-sm);
}
#hdChatMessages .hd-msg--client.hd-msg--group-mid .hd-msg__bubble,
#hdChatMessages .hd-msg--client.hd-msg--group-end .hd-msg__bubble,
#hdAdminMessages .hd-msg--client.hd-msg--group-mid .hd-msg__bubble,
#hdAdminMessages .hd-msg--client.hd-msg--group-end .hd-msg__bubble {
  border-top-right-radius: var(--hd-radius-sm);
}
#hdWidgetMessages .hd-msg--client.hd-msg--group-start .hd-msg__bubble,
#hdWidgetMessages .hd-msg--client.hd-msg--group-mid .hd-msg__bubble {
  border-bottom-right-radius: var(--hd-radius-sm);
}
#hdChatMessages .hd-msg--client.hd-msg--group-start .hd-msg__bubble,
#hdChatMessages .hd-msg--client.hd-msg--group-mid .hd-msg__bubble,
#hdAdminMessages .hd-msg--client.hd-msg--group-start .hd-msg__bubble,
#hdAdminMessages .hd-msg--client.hd-msg--group-mid .hd-msg__bubble {
  border-bottom-right-radius: var(--hd-radius-sm);
}
.hd-msg-divider {
  display: flex;
  align-items: center;
  gap: var(--hd-sp-3);
  margin: var(--hd-sp-4) 0 var(--hd-sp-2);
  color: var(--hd-text-muted);
  font-size: 11px;
  font-weight: 600;
}
.hd-msg-divider::before,
.hd-msg-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hd-border);
}
.hd-msg-attachments {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hd-msg-file {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--hd-text-xs);
  font-family: inherit;
  color: var(--hd-primary);
  text-align: left;
}
.hd-msg-file:hover {
  text-decoration: underline;
}
.hd-msg-file--image {
  cursor: zoom-in;
}
.hd-msg-image-thumb {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: 220px;
  text-decoration: none;
  color: var(--hd-primary);
  cursor: zoom-in;
}
.hd-msg-image-thumb--button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  text-align: left;
}
.hd-msg-image-thumb__img {
  display: block;
  width: 100%;
  max-width: 220px;
  max-height: 150px;
  object-fit: cover;
  border-radius: var(--hd-radius);
  border: 1px solid var(--hd-border);
  background: var(--hd-bg-subtle);
  transition: transform var(--hd-t-fast), box-shadow var(--hd-t-fast), border-color var(--hd-t-fast);
}
.hd-msg-image-thumb__name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}
.hd-msg-image-thumb:hover .hd-msg-image-thumb__img,
.hd-msg-image-thumb:focus .hd-msg-image-thumb__img {
  transform: translateY(-1px);
  border-color: var(--hd-primary);
  box-shadow: var(--hd-shadow);
}
.hd-msg--client .hd-msg-image-thumb__name {
  color: var(--hd-text-on-primary);
}
.hd-msg--client .hd-msg-image-thumb__img {
  border-color: var(--hd-overlay-on-primary-border);
  background: var(--hd-overlay-on-primary);
}
.hd-msg-audio {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hd-msg-audio audio {
  width: 100%;
  max-width: 260px;
  height: 34px;
}
.hd-msg-audio a {
  text-decoration: none;
  font-size: var(--hd-text-xs);
  color: var(--hd-primary);
}
.hd-msg-audio--custom {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--hd-radius-full);
  border: 1px solid var(--hd-border);
  background: var(--hd-bg);
  min-width: 220px;
  max-width: 280px;
}
.hd-msg-audio--custom audio {
  display: none;
}
.hd-msg-audio__toggle {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--hd-primary);
  color: var(--hd-text-on-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--hd-t-fast), background var(--hd-t-fast);
}
.hd-msg-audio__toggle:hover {
  transform: scale(1.06);
  background: var(--hd-primary-dark);
}
.hd-msg-audio__content {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hd-msg-audio__track {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 4px 0;
  margin: 0;
  cursor: pointer;
  width: 100%;
}
.hd-msg-audio__wave {
  position: relative;
  display: block;
  width: 100%;
  height: 6px;
  border-radius: var(--hd-radius-full);
  background: var(--hd-wave-bg);
  overflow: hidden;
}
.hd-msg-audio__wave::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(
    90deg,
    var(--hd-wave-stripe) 0 2px,
    transparent 2px 5px
  );
}
.hd-msg-audio__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(90deg, var(--hd-primary), var(--hd-primary-light));
  border-radius: inherit;
}
.hd-msg-audio__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--hd-text-muted);
  line-height: 1;
}
.hd-msg-audio__download {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--hd-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--hd-text-muted);
  text-decoration: none;
  background: var(--hd-bg-subtle);
  transition: all var(--hd-t-fast);
}
.hd-msg-audio__download:hover {
  color: var(--hd-primary);
  border-color: var(--hd-primary);
}
.hd-msg-audio--custom.is-playing .hd-msg-audio__toggle {
  background: var(--hd-primary-dark);
}
.hd-msg--client .hd-msg-file,
.hd-msg--client .hd-msg-audio a {
  color: var(--hd-text-on-primary);
}
.hd-msg--client .hd-msg-audio--custom {
  background: var(--hd-overlay-on-primary);
  border-color: var(--hd-overlay-on-primary-border);
}
.hd-msg--client .hd-msg-audio__wave {
  background: var(--hd-overlay-on-primary-strong);
}
.hd-msg--client .hd-msg-audio__wave::before {
  background: repeating-linear-gradient(
    90deg,
    var(--hd-overlay-on-primary-strong) 0 2px,
    transparent 2px 5px
  );
}
.hd-msg--client .hd-msg-audio__fill {
  background: var(--hd-text-on-primary-soft);
}
.hd-msg--client .hd-msg-audio__meta {
  color: var(--hd-text-on-primary-soft);
}
.hd-msg--client .hd-msg-audio__download {
  background: var(--hd-overlay-on-primary);
  border-color: var(--hd-overlay-on-primary-border);
  color: var(--hd-text-on-primary);
}
.hd-msg--client .hd-msg-audio__download:hover {
  background: var(--hd-overlay-on-primary-strong);
}

.hd-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
}
.hd-msg__bubble--typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  min-width: 52px;
}
.hd-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hd-gray-400);
  animation: hdTypingBounce 1.2s infinite;
}
.hd-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.hd-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}
.hd-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hd-gray-400);
  animation: hdTyping 1.4s infinite;
}
.hd-typing__dot:nth-child(2) {
  animation-delay: 0.2s;
}
.hd-typing__dot:nth-child(3) {
  animation-delay: 0.4s;
}
.hd-scroll-btn {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%) translateY(8px);
  background: var(--hd-primary);
  color: var(--hd-text-on-primary);
  border: none;
  border-radius: var(--hd-radius-full);
  padding: 6px 16px;
  font-size: var(--hd-text-xs);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--hd-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  z-index: 2;
}
.hd-scroll-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.hd-table {
  width: 100%;
  border-collapse: collapse;
}
.hd-table thead {
  background: var(--hd-bg-subtle);
}
.hd-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--hd-text-xs);
  font-weight: 700;
  color: var(--hd-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--hd-border);
  white-space: nowrap;
}
.hd-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--hd-border);
  font-size: var(--hd-text-sm);
  color: var(--hd-text-muted);
  vertical-align: middle;
}
.hd-table tbody tr {
  transition: background var(--hd-t-fast);
}
.hd-table tbody tr:hover {
  background: var(--hd-bg-subtle);
}
.hd-table tbody tr:last-child td {
  border-bottom: 0;
}

.hd-admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.hd-sidebar {
  background: var(--hd-bg);
  border-right: 1px solid var(--hd-border);
  padding: var(--hd-sp-6) 0;
}
.hd-sidebar__nav {
  list-style: none;
  padding: 0;
  margin: 0;
}
.hd-sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--hd-sp-3);
  padding: 10px var(--hd-sp-5);
  color: var(--hd-text-muted);
  font-size: var(--hd-text-sm);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--hd-t-fast);
  font-weight: 500;
}
.hd-sidebar__link:hover {
  background: var(--hd-primary-alpha);
  color: var(--hd-primary);
}
.hd-sidebar__link.active {
  background: var(--hd-primary-alpha);
  color: var(--hd-primary);
  border-left-color: var(--hd-primary);
}

.hd-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--hd-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--hd-sp-4);
  z-index: var(--hd-z-modal);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--hd-t-base), visibility var(--hd-t-base);
}
.hd-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.hd-modal {
  background: var(--hd-bg);
  border-radius: var(--hd-radius-lg);
  box-shadow: var(--hd-shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform var(--hd-t-base);
}
.hd-modal-backdrop.open .hd-modal {
  transform: none;
}
.hd-modal__header {
  padding: var(--hd-sp-5) var(--hd-sp-6);
  border-bottom: 1px solid var(--hd-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hd-modal__title {
  font-size: var(--hd-text-lg);
  font-weight: 700;
  color: var(--hd-text);
}
.hd-modal__close {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--hd-radius);
  color: var(--hd-text-subtle);
  transition: all var(--hd-t-fast);
  display: flex;
}
.hd-modal__close:hover {
  background: var(--hd-bg-muted);
  color: var(--hd-text);
}
/* TinyMCE fullscreen and dialogs must stay above admin menu/topbar. */
body.dashboard_main div.mce-fullscreen,
body.dashboard_main iframe.mce-fullscreen,
body.dashboard_main .mce-container.mce-fullscreen {
  z-index: 100650 !important;
}
body.dashboard_main .mce-window,
body.dashboard_main .mce-floatpanel {
  z-index: 100660 !important;
}
body.dashboard_main .tox.tox-tinymce.tox-fullscreen {
  z-index: 100650 !important;
}
body.dashboard_main .tox.tox-tinymce-aux,
body.dashboard_main .tox.tox-dialog-wrap {
  z-index: 100660 !important;
}
.hd-modal__body {
  padding: var(--hd-sp-6);
}
.hd-modal__footer {
  padding: var(--hd-sp-4) var(--hd-sp-6);
  border-top: 1px solid var(--hd-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--hd-sp-3);
}
.hd-image-modal__body {
  padding: var(--hd-sp-4) var(--hd-sp-6);
}
.hd-image-modal__img {
  width: 100%;
  max-height: min(70vh, 700px);
  object-fit: contain;
  border-radius: var(--hd-radius);
  background: var(--hd-bg-subtle);
  border: 1px solid var(--hd-border);
}

.hd-toast-container {
  position: fixed;
  top: var(--hd-sp-5);
  right: var(--hd-sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--hd-sp-3);
  z-index: var(--hd-z-toast);
}
.hd-toast {
  display: flex;
  align-items: center;
  gap: var(--hd-sp-3);
  padding: var(--hd-sp-3) var(--hd-sp-5);
  background: var(--hd-surface-inverse);
  color: var(--hd-text-on-primary);
  border-radius: var(--hd-radius);
  box-shadow: var(--hd-shadow-lg);
  font-size: var(--hd-text-sm);
  animation: hdSlideRight var(--hd-t-base);
  min-width: 280px;
  max-width: 380px;
}
.hd-toast--success {
  border-left: 4px solid var(--hd-success);
}
.hd-toast--error {
  border-left: 4px solid var(--hd-danger);
}
.hd-toast--warning {
  border-left: 4px solid var(--hd-warning);
}

/* ---- Client Helpdesk ---- */
.hd-helpdesk-body {
  position: relative;
  overflow: hidden;
}
.hd-helpdesk-body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(920px 420px at 12% -8%, rgba(159, 0, 255, 0.1), transparent 62%),
    radial-gradient(760px 360px at 88% 8%, rgba(124, 58, 237, 0.08), transparent 64%);
}
.hd-client-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: var(--hd-sp-8) var(--hd-sp-6);
}
.hd-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--hd-sp-6);
  gap: var(--hd-sp-3);
  background: linear-gradient(135deg, rgba(159, 0, 255, 0.12), rgba(159, 0, 255, 0.04));
  border: 1px solid rgba(159, 0, 255, 0.24);
  border-radius: var(--hd-radius-lg);
  padding: var(--hd-sp-5) var(--hd-sp-6);
  box-shadow: var(--hd-shadow-sm);
}
.hd-page-title {
  font-size: var(--hd-text-2xl);
  font-weight: 800;
  color: var(--hd-text);
  margin: 0;
}
.hd-page-subtitle {
  margin: 4px 0 0;
  font-size: var(--hd-text-sm);
  color: var(--hd-text-muted);
}
.hd-alert {
  background: var(--hd-warning-alpha);
  color: var(--hd-warning-ink);
  border: 1px solid var(--hd-warning-border);
  border-radius: var(--hd-radius);
  padding: var(--hd-sp-4);
  margin-bottom: var(--hd-sp-5);
  display: flex;
  align-items: center;
  gap: var(--hd-sp-3);
  flex-wrap: wrap;
  font-weight: 600;
}
.hd-ticket-list {
  display: flex;
  flex-direction: column;
  gap: var(--hd-sp-4);
}
.hd-ticket-item {
  border: 1px solid var(--hd-border);
  border-radius: 14px;
  padding: var(--hd-sp-4) var(--hd-sp-5);
  background: linear-gradient(180deg, var(--hd-bg) 0%, var(--hd-bg-subtle) 100%);
  text-decoration: none;
  color: inherit;
  transition: all var(--hd-t-fast);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--hd-sp-4);
}
.hd-ticket-item:hover {
  border-color: rgba(159, 0, 255, 0.44);
  box-shadow: var(--hd-shadow);
  transform: translateY(-1px);
}
.hd-ticket-item__title {
  margin: 0 0 5px;
  color: var(--hd-text);
  font-weight: 700;
  font-size: var(--hd-text-base);
}
.hd-ticket-item__meta {
  margin: 0;
  color: var(--hd-text-muted);
  font-size: var(--hd-text-xs);
}
.hd-helpdesk-body .hd-badge--active {
  background: var(--hd-warning-soft);
  color: var(--hd-warning-ink);
  border: 1px solid var(--hd-warning-border);
}
.hd-helpdesk-body .hd-badge--resolved {
  background: var(--hd-success-soft);
  color: var(--hd-success-ink);
  border: 1px solid var(--hd-success-border);
}
.hd-pill-tabs {
  display: inline-flex;
  background: rgba(159, 0, 255, 0.08);
  border-radius: var(--hd-radius-full);
  padding: 4px;
  margin-bottom: var(--hd-sp-5);
  gap: 4px;
  border: 1px solid rgba(159, 0, 255, 0.2);
}
.hd-pill-tab {
  border: 0;
  background: transparent;
  color: var(--hd-text-muted);
  font-size: var(--hd-text-xs);
  font-weight: 700;
  border-radius: var(--hd-radius-full);
  padding: 7px 14px;
  cursor: pointer;
}
.hd-pill-tab.active {
  background: linear-gradient(135deg, #ffffff 0%, #f8f2ff 100%);
  color: var(--hd-primary);
  box-shadow: var(--hd-shadow-sm);
}
.hd-ticket-detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--hd-sp-5);
}
.hd-ticket-detail-layout #hdTicketMessages.hd-messages {
  min-height: 260px;
  max-height: clamp(320px, 58vh, 640px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.hd-ticket-main,
.hd-ticket-side {
  min-width: 0;
}
.hd-ticket-reply {
  padding: var(--hd-sp-4);
  border-top: 1px solid var(--hd-border);
  display: flex;
  flex-direction: column;
  gap: var(--hd-sp-3);
}
.hd-ticket-resolved-card {
  margin-top: 12px;
  position: relative;
  overflow: hidden;
  border-color: rgba(159, 0, 255, 0.3);
  background:
    radial-gradient(140px 70px at 85% 8%, rgba(196, 67, 255, 0.14), transparent 72%),
    linear-gradient(150deg, var(--hd-bg) 0%, #fbf4ff 100%);
}
.hd-ticket-resolved-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.34) 45%, transparent 70%);
  opacity: 0.5;
}
.hd-ticket-resolved-card__body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.hd-ticket-resolved-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--hd-primary);
  background: rgba(159, 0, 255, 0.12);
  border: 1px solid rgba(159, 0, 255, 0.24);
}
.hd-ticket-resolved-card__title {
  color: var(--hd-text);
  font-size: 22px;
  line-height: 1.25;
}
.hd-ticket-resolved-card__desc {
  margin: 0;
  color: var(--hd-text-muted);
  font-size: 14px;
  line-height: 1.45;
}
.hd-ticket-rate-btn {
  width: 100%;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: linear-gradient(90deg, var(--hd-primary-dark) 0%, var(--hd-primary) 58%, #c243ff 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(159, 0, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.hd-ticket-rate-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.42) 45%, transparent 70%);
  transform: translateX(-130%);
  transition: transform 460ms ease;
}
.hd-ticket-rate-btn i,
.hd-ticket-rate-btn span {
  position: relative;
  z-index: 1;
}
.hd-ticket-rate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(159, 0, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  background: linear-gradient(90deg, var(--hd-primary-dark) 0%, #ad1aff 56%, #d05dff 100%);
}
.hd-ticket-rate-btn:hover::before {
  transform: translateX(125%);
}
.hd-ticket-rate-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(159, 0, 255, 0.24),
    0 14px 30px rgba(159, 0, 255, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.hd-ticket-rate-btn:active {
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .hd-ticket-rate-btn,
  .hd-ticket-rate-btn::before {
    transition: none;
  }
  .hd-ticket-rate-btn:hover {
    transform: none;
  }
}
.hd-list-empty {
  text-align: center;
  color: var(--hd-text-muted);
  padding: var(--hd-sp-8);
}
.hd-pagination {
  display: flex;
  justify-content: space-between;
  margin-top: var(--hd-sp-5);
}
.hd-load-more-wrap {
  justify-content: center;
}

.hd-kb-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: var(--hd-sp-5);
  align-items: stretch;
}
.hd-kb-search-card .hd-card__body,
.hd-kb-article-card .hd-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--hd-sp-3);
}
.hd-kb-search-input {
  width: 100%;
}
.hd-kb-results {
  flex: 1;
  min-height: 320px;
  max-height: 68vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}
.hd-kb-results-heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--hd-text-muted);
  margin: 2px 0 8px;
}
.hd-kb-result-item {
  margin-top: 0;
  margin-bottom: 6px;
}
.hd-kb-result-item:last-child {
  margin-bottom: 0;
}
.hd-kb-result-item.active {
  border-color: rgba(159, 0, 255, 0.46);
  box-shadow: var(--hd-shadow-sm);
}
.hd-kb-article-card .hd-card__header {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}
.hd-kb-article-meta {
  display: block;
  margin: 0;
  color: var(--hd-text-subtle);
  font-size: var(--hd-text-xs);
}
.hd-kb-article-card .hd-card__body {
  min-height: 520px;
}
.hd-kb-article-content {
  color: var(--hd-text);
  font-size: 15px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}
.hd-kb-article-content p {
  margin: 0 0 12px;
}
.hd-kb-article-content p:last-child {
  margin-bottom: 0;
}
.hd-kb-article-content h1,
.hd-kb-article-content h2,
.hd-kb-article-content h3,
.hd-kb-article-content h4,
.hd-kb-article-content h5 {
  margin: 10px 0 8px;
  color: var(--hd-text);
  line-height: 1.3;
}
.hd-kb-article-content ul,
.hd-kb-article-content ol {
  margin: 0 0 12px 18px;
  padding: 0;
}
.hd-kb-article-content li {
  margin-bottom: 4px;
}
.hd-kb-article-content a {
  color: var(--hd-primary);
  font-weight: 700;
  text-decoration: underline;
}
.hd-kb-article-placeholder,
.hd-kb-article-loading {
  flex: 1;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--hd-text-muted);
  font-size: var(--hd-text-sm);
}
.hd-kb-article-loading {
  gap: 8px;
  font-weight: 600;
}
.hd-kb-list-empty {
  padding: var(--hd-sp-6) var(--hd-sp-3);
}

/* ---- Client Alignment: Marketing Plan Look ---- */
.hd-helpdesk-marketing {
  --hd-font: 'Plus Jakarta Sans', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
.hd-helpdesk-marketing .hd-client-layout {
  max-width: 1180px;
  padding: 34px 24px 44px;
}
.hd-helpdesk-marketing .hd-page-header {
  align-items: flex-start;
  border-radius: 20px;
  padding: 22px 24px;
  border: 1px solid rgba(228, 228, 240, 0.9);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 36px rgba(24, 24, 43, 0.08);
  backdrop-filter: blur(12px);
}
.hd-helpdesk-marketing .hd-page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.hd-helpdesk-marketing .hd-page-subtitle {
  margin-top: 6px;
  color: #5a5a78;
  font-size: 13px;
}
.hd-helpdesk-marketing .hd-btn {
  border-radius: 12px;
  font-weight: 700;
  box-shadow: none;
}
.hd-helpdesk-marketing .hd-btn--primary {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(135deg, #7b2fbe 0%, #9333ea 100%);
  box-shadow: 0 10px 24px rgba(123, 47, 190, 0.22);
}
.hd-helpdesk-marketing .hd-btn--primary:hover {
  background: linear-gradient(135deg, #6b24aa 0%, #7b2fbe 100%);
  box-shadow: 0 14px 28px rgba(123, 47, 190, 0.3);
  transform: translateY(-1px);
}
.hd-helpdesk-marketing .hd-btn--secondary {
  border-color: rgba(228, 228, 240, 0.9);
  background: rgba(255, 255, 255, 0.74);
}
.hd-helpdesk-marketing .hd-btn--secondary:hover {
  background: #ffffff;
  border-color: rgba(123, 47, 190, 0.3);
}
.hd-helpdesk-marketing .hd-card,
.hd-helpdesk-marketing .hd-ticket-item,
.hd-helpdesk-marketing .hd-pill-tabs {
  border: 1px solid rgba(228, 228, 240, 0.9);
  box-shadow: 0 10px 28px rgba(24, 24, 43, 0.06);
}
.hd-helpdesk-marketing .hd-card {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
}
.hd-helpdesk-marketing .hd-card__header {
  padding: 14px 18px;
  background: #fafafa;
  border-bottom-color: rgba(228, 228, 240, 0.92);
}
.hd-helpdesk-marketing .hd-ticket-item {
  border-radius: 18px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.9);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.hd-helpdesk-marketing .hd-ticket-item:hover {
  border-color: rgba(123, 47, 190, 0.38);
  box-shadow: 0 14px 34px rgba(24, 24, 43, 0.1);
  transform: translateY(-1px);
}
.hd-helpdesk-marketing .hd-ticket-item__title {
  font-size: 18px;
  letter-spacing: -0.02em;
}
.hd-helpdesk-marketing .hd-ticket-item__meta {
  color: #6b6b88;
  font-size: 13px;
}
.hd-helpdesk-marketing .hd-pill-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
}
.hd-helpdesk-marketing .hd-pill-tab {
  border-radius: 12px;
  padding: 10px 15px;
  font-size: 13px;
  color: #5a5a78;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.hd-helpdesk-marketing .hd-pill-tab:hover {
  transform: translateY(-1px);
}
.hd-helpdesk-marketing .hd-pill-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg, #7b2fbe 0%, #9333ea 100%);
  box-shadow: 0 10px 18px rgba(123, 47, 190, 0.2);
}
.hd-helpdesk-marketing .hd-alert {
  border-radius: 16px;
  background: linear-gradient(160deg, #fff5df 0%, #fff0cc 100%);
  border-color: #f3d9a0;
  color: #6b4b13;
}
.hd-helpdesk-marketing .hd-ticket-detail-layout {
  gap: 20px;
  align-items: flex-start;
}
.hd-helpdesk-marketing .hd-ticket-main #hdTicketMessages.hd-messages {
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.88) 0%, rgba(255, 255, 255, 0.96) 100%);
}
.hd-helpdesk-marketing .hd-ticket-side .hd-card__body {
  font-size: 13.5px !important;
}
.hd-helpdesk-marketing .hd-kb-layout {
  grid-template-columns: minmax(300px, 370px) minmax(0, 1fr);
  gap: 20px;
}
.hd-helpdesk-marketing .hd-kb-search-card .hd-card__header,
.hd-helpdesk-marketing .hd-kb-article-card .hd-card__header {
  background: #fafafa;
}
.hd-helpdesk-marketing .hd-kb-results {
  max-height: min(72vh, 760px);
  padding-right: 4px;
}
.hd-helpdesk-marketing .hd-kb-result-item {
  border: 1px solid rgba(228, 228, 240, 0.95);
  border-radius: 14px;
  background: #ffffff;
  padding: 12px 14px;
}
.hd-helpdesk-marketing .hd-kb-result-item:hover {
  border-color: rgba(123, 47, 190, 0.35);
  box-shadow: 0 8px 20px rgba(24, 24, 43, 0.08);
}
.hd-helpdesk-marketing .hd-kb-result-item.active {
  border-color: rgba(123, 47, 190, 0.44) !important;
  box-shadow: none !important;
  background: #c299e61f !important;
}
.hd-helpdesk-marketing .hd-kb-article-card .hd-card__body {
  min-height: 560px;
}
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-page-header,
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-card,
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-ticket-item,
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-pill-tabs {
  border-color: rgba(241, 217, 255, 0.2);
  background: rgba(26, 5, 44, 0.78);
  box-shadow: 0 16px 34px rgba(3, 0, 8, 0.36);
}
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-page-subtitle,
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-ticket-item__meta,
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-pill-tab {
  color: rgba(235, 227, 255, 0.75);
}
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-card__header,
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-kb-search-card .hd-card__header,
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-kb-article-card .hd-card__header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom-color: rgba(241, 217, 255, 0.16);
}
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-btn--secondary {
  border-color: rgba(241, 217, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: #f5eeff;
}
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.09);
}
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-kb-result-item {
  border-color: rgba(241, 217, 255, 0.16);
  background: rgba(255, 255, 255, 0.02);
}
body#main[data-theme="dark"] .hd-helpdesk-marketing .hd-ticket-main #hdTicketMessages.hd-messages {
  background: linear-gradient(180deg, rgba(32, 10, 53, 0.82) 0%, rgba(26, 5, 44, 0.88) 100%);
}
@media (max-width: 900px) {
  .hd-helpdesk-marketing .hd-page-header {
    padding: 18px;
  }
  .hd-helpdesk-marketing .hd-kb-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .hd-helpdesk-marketing .hd-client-layout {
    padding: 18px 14px 26px;
  }
  .hd-helpdesk-marketing .hd-page-header {
    border-radius: 16px;
    padding: 16px;
  }
  .hd-helpdesk-marketing .hd-page-title {
    font-size: 21px;
  }
  .hd-helpdesk-marketing .hd-pill-tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }
  .hd-helpdesk-marketing .hd-pill-tab {
    flex: 0 0 auto;
  }
  .hd-helpdesk-marketing .hd-ticket-item {
    padding: 14px 15px;
  }
  .hd-helpdesk-marketing .hd-ticket-item__title {
    font-size: 16px;
  }
}

/* ---- KB Hero Banner ---- */
.hd-kb-hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 48px 36px 42px;
  margin-bottom: 0;
  text-align: center;
  background: linear-gradient(135deg, #5b1a96 0%, #7b2fbe 42%, #9333ea 76%, #a855f7 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 56px rgba(91, 26, 150, 0.28), 0 8px 20px rgba(123, 47, 190, 0.18);
}
.hd-kb-hero::before {
  content: "";
  position: absolute;
  top: -70px;
  right: -70px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055);
  pointer-events: none;
}
.hd-kb-hero::after {
  content: "";
  position: absolute;
  bottom: -90px;
  left: -40px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.038);
  pointer-events: none;
}
.hd-kb-hero__back {
  position: absolute;
  top: 16px;
  left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-family: var(--hd-font);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--hd-t-fast);
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hd-kb-hero__back:hover {
  background: rgba(255, 255, 255, 0.26);
}
.hd-kb-hero__back .ti {
  font-size: 15px;
}
.hd-kb-hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.hd-kb-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px 5px 10px;
  border-radius: var(--hd-radius-full);
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.hd-kb-hero__badge .ti {
  font-size: 14px;
}
.hd-kb-hero__title,
.hd-helpdesk-marketing .hd-kb-hero__title,
.hd-helpdesk-body .hd-kb-hero__title {
  margin: 4px 0 0;
  color: #ffffff !important;
  font-family: var(--hd-font);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
}
.hd-kb-hero__subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  line-height: 1.55;
  max-width: 480px;
}

/* ---- KB Search Dock (below hero, with dropdown) ---- */
.hd-kb-search-dock {
  display: flex;
  justify-content: center;
  margin: -24px 0 24px;
  position: relative;
  z-index: 10;
}
.hd-kb-search-wrap {
  position: relative;
  width: 100%;
  max-width: 620px;
  filter: drop-shadow(0 8px 24px rgba(18, 2, 39, 0.18));
}
.hd-kb-search-wrap__icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(123, 47, 190, 0.55);
  font-size: 18px;
  pointer-events: none;
  z-index: 2;
  transition: top var(--hd-t-fast);
}
.hd-kb-search-wrap.is-open .hd-kb-search-wrap__icon {
  top: 26px;
}
.hd-kb-search-wrap__input {
  width: 100%;
  height: 52px;
  padding: 0 20px 0 50px;
  border-radius: 16px;
  border: 1.5px solid rgba(228, 228, 240, 0.9);
  background: var(--hd-bg);
  font-family: var(--hd-font);
  font-size: 15px;
  font-weight: 500;
  color: var(--hd-text);
  box-shadow: 0 4px 20px rgba(18, 2, 39, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color var(--hd-t-fast), box-shadow var(--hd-t-fast), border-radius var(--hd-t-fast);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 2;
}
.hd-kb-search-wrap__input:focus,
.hd-kb-search-wrap.is-open .hd-kb-search-wrap__input {
  border-color: rgba(123, 47, 190, 0.4);
  box-shadow: 0 4px 20px rgba(18, 2, 39, 0.1), 0 0 0 3px rgba(159, 0, 255, 0.1);
}
.hd-kb-search-wrap.is-open .hd-kb-search-wrap__input {
  border-radius: 16px 16px 0 0;
  border-bottom-color: transparent;
  box-shadow: none;
}
.hd-kb-search-wrap__input::placeholder {
  color: var(--hd-text-subtle);
  font-weight: 400;
}
.hd-kb-search-wrap__input::-webkit-search-cancel-button,
.hd-kb-search-wrap__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* KB results dropdown */
.hd-kb-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--hd-bg);
  border: 1.5px solid rgba(123, 47, 190, 0.4);
  border-top: none;
  border-radius: 0 0 16px 16px;
  padding: 8px 10px 12px;
  max-height: min(68vh, 440px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1;
  box-shadow: 0 16px 36px rgba(18, 2, 39, 0.14);
}
.hd-kb-search-wrap.is-open .hd-kb-dropdown {
  display: block;
}
.hd-kb-dropdown .hd-kb-results-heading {
  font-size: 11px;
  font-weight: 700;
  color: var(--hd-text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 6px 8px;
}
.hd-kb-dropdown .hd-kb-result-item {
  border: 1px solid rgba(228, 228, 240, 0.9);
  border-radius: 12px;
  background: var(--hd-bg);
  padding: 10px 14px;
  margin-bottom: 5px;
}
.hd-kb-dropdown .hd-kb-result-item:last-child {
  margin-bottom: 0;
}
.hd-kb-dropdown .hd-kb-result-item:hover {
  border-color: rgba(123, 47, 190, 0.35);
  box-shadow: 0 4px 14px rgba(18, 2, 39, 0.07);
}
.hd-kb-dropdown .hd-kb-result-item.active {
  border-color: rgba(123, 47, 190, 0.44);
  background: rgba(159, 0, 255, 0.06);
}

/* KB article card — full width now */
.hd-helpdesk-marketing .hd-kb-article-card {
  display: block;
}

/* KB article placeholder with icon */
.hd-kb-article-placeholder {
  flex-direction: column;
  gap: 12px;
}
.hd-kb-placeholder-icon {
  font-size: 44px;
  color: var(--hd-gray-300);
  line-height: 1;
  display: block;
}

/* KB article meta as pill badge */
.hd-kb-article-meta:not(:empty) {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--hd-radius-full);
  background: var(--hd-primary-alpha);
  color: var(--hd-primary-dark);
  font-size: 11px;
  font-weight: 600;
}

/* Dark mode: KB hero */
body#main[data-theme="dark"] .hd-kb-hero {
  background: linear-gradient(135deg, #320b5a 0%, #4e1488 42%, #6b24aa 76%, #7b2fbe 100%);
  border-color: rgba(241, 217, 255, 0.1);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.52), 0 8px 20px rgba(91, 26, 150, 0.28);
}

/* Dark mode: KB search dock */
body#main[data-theme="dark"] .hd-kb-search-wrap__input {
  border-color: rgba(241, 217, 255, 0.16);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
body#main[data-theme="dark"] .hd-kb-search-wrap__input:focus,
body#main[data-theme="dark"] .hd-kb-search-wrap.is-open .hd-kb-search-wrap__input {
  border-color: rgba(200, 150, 255, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(159, 0, 255, 0.15);
}
body#main[data-theme="dark"] .hd-kb-search-wrap.is-open .hd-kb-search-wrap__input {
  box-shadow: none;
}
body#main[data-theme="dark"] .hd-kb-search-wrap__icon {
  color: rgba(200, 150, 255, 0.5);
}
body#main[data-theme="dark"] .hd-kb-dropdown {
  border-color: rgba(200, 150, 255, 0.3);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}
body#main[data-theme="dark"] .hd-kb-dropdown .hd-kb-result-item {
  border-color: rgba(241, 217, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
}
body#main[data-theme="dark"] .hd-kb-dropdown .hd-kb-result-item:hover {
  border-color: rgba(200, 150, 255, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}
body#main[data-theme="dark"] .hd-kb-dropdown .hd-kb-result-item.active {
  border-color: rgba(200, 150, 255, 0.44);
  background: rgba(159, 0, 255, 0.1);
}
body#main[data-theme="dark"] .hd-kb-placeholder-icon {
  color: var(--hd-gray-700);
}
body#main[data-theme="dark"] .hd-kb-article-meta:not(:empty) {
  background: rgba(159, 0, 255, 0.18);
  color: rgba(220, 180, 255, 0.92);
}

/* Responsive: KB hero */
@media (max-width: 900px) {
  .hd-kb-hero {
    padding: 46px 24px 38px;
  }
  .hd-kb-search-dock {
    padding: 0 4px;
  }
}
@media (max-width: 768px) {
  .hd-kb-hero {
    border-radius: 16px;
    padding: 44px 18px 32px;
  }
  .hd-kb-hero__title {
    font-size: 24px;
  }
  .hd-kb-hero__subtitle {
    font-size: 13px;
  }
  .hd-kb-search-wrap__input {
    height: 48px;
    font-size: 14px;
  }
}

/* ---- Floating Widget ---- */
.hd-widget-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hd-primary), var(--hd-primary-light));
  border: none;
  color: var(--hd-text-on-primary);
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(23, 7, 53, 0.35), 0 6px 16px rgba(23, 7, 53, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all var(--hd-t-base);
  z-index: var(--hd-z-widget);
  overflow: visible;
}
.hd-widget-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 24px 44px rgba(23, 7, 53, 0.42), 0 8px 18px rgba(23, 7, 53, 0.26);
}
.hd-widget-btn.has-unread {
  animation: hdWidgetPulse 2s infinite;
}
.hd-widget-btn::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.06) 62%);
  pointer-events: none;
}
.hd-widget-btn__pulse {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(141, 38, 255, 0.28) 0%, rgba(141, 38, 255, 0.14) 30%, rgba(141, 38, 255, 0) 72%);
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.28s ease, transform 0.32s ease;
  pointer-events: none;
}
.hd-widget-btn:hover .hd-widget-btn__pulse {
  opacity: 1;
  transform: scale(1);
}
.hd-widget-btn__icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.hd-widget-btn .hd-widget-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  background: var(--hd-danger);
  color: var(--hd-text-on-primary);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--hd-bg);
  padding: 0 4px;
  box-shadow: 0 8px 18px rgba(186, 18, 56, 0.33);
}

/* ---- Notificação flutuante do chat ---- */
.hd-notify {
  position: fixed;
  right: 24px;
  bottom: calc(24px + 62px + 14px);
  width: min(420px, calc(100vw - 32px));
  background: var(--hd-bg);
  border: 1px solid var(--hd-border);
  border-radius: 18px;
  box-shadow: 0 24px 54px rgba(9, 13, 38, 0.23), 0 6px 14px rgba(9, 13, 38, 0.12);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  z-index: var(--hd-z-widget);
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease, box-shadow 0.24s ease;
  pointer-events: none;
}
.hd-notify:not(.hd-hidden) {
  pointer-events: auto;
}
.hd-notify.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.hd-notify:hover {
  box-shadow: 0 28px 58px rgba(9, 13, 38, 0.28), 0 8px 18px rgba(9, 13, 38, 0.13);
}
.hd-notify__avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hd-primary), var(--hd-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  overflow: hidden;
  border: 2px solid var(--hd-bg);
  box-shadow: 0 6px 16px rgba(102, 40, 210, 0.28);
}
.hd-notify__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.hd-notify__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hd-notify__meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  order: 2;
}
.hd-notify__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--hd-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.hd-notify__time {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--hd-text-subtle);
  white-space: nowrap;
}
.hd-notify__time::before {
  content: "•";
  margin-right: 6px;
  color: var(--hd-text-subtle);
}
.hd-notify__text {
  order: 1;
  font-size: 17px;
  color: var(--hd-text);
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}
.hd-notify__close {
  background: none;
  border: none;
  color: var(--hd-text-subtle);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-top: 1px;
  margin-left: 4px;
  opacity: 0;
  transition: opacity var(--hd-t-fast), color var(--hd-t-fast);
}
.hd-notify:hover .hd-notify__close {
  opacity: 1;
}
.hd-notify__close:hover {
  color: var(--hd-primary);
}
.hd-notify.dismissing {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.hd-widget-panel {
  position: fixed;
  bottom: calc(24px + 68px);
  right: 24px;
  width: min(450px, calc(100vw - 48px));
  height: min(660px, calc(100vh - 112px));
  background: var(--hd-bg);
  border-radius: var(--hd-radius-xl);
  box-shadow: var(--hd-shadow-xl);
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
  pointer-events: none;
  z-index: var(--hd-z-widget);
  border: 1px solid var(--hd-border);
  overflow: hidden;
}
.hd-widget-panel.hd-widget-panel--expanded {
  width: min(675px, calc(100vw - 48px));
  height: min(990px, calc(100vh - 96px));
}
.hd-widget-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hd-widget-header {
  background: linear-gradient(135deg, var(--hd-primary), var(--hd-primary-light));
  padding: var(--hd-sp-4) var(--hd-sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.hd-widget-header-info {
  display: flex;
  align-items: center;
  gap: var(--hd-sp-3);
}
.hd-widget-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--hd-overlay-on-primary-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
}
.hd-widget-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.hd-widget-header-title {
  color: var(--hd-text-on-primary);
  font-weight: 700;
  font-size: var(--hd-text-base);
  line-height: 1.2;
}
.hd-widget-header-status {
  color: var(--hd-text-on-primary-muted);
  font-size: var(--hd-text-xs);
  display: flex;
  align-items: center;
  gap: 4px;
}
.hd-widget-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hd-online);
}
.hd-widget-close {
  background: none;
  border: none;
  color: var(--hd-text-on-primary-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--hd-radius);
  transition: all var(--hd-t-fast);
  display: flex;
  font-size: 18px;
}
.hd-widget-close:hover {
  background: var(--hd-overlay-soft);
  color: var(--hd-text-on-primary);
}
.hd-widget-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.hd-widget-tabs {
  display: flex;
  border-bottom: 1px solid var(--hd-border);
  flex-shrink: 0;
}
.hd-widget-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: var(--hd-text-sm);
  font-weight: 600;
  color: var(--hd-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--hd-t-fast);
  background: none;
  border-top: 0;
  border-left: 0;
  border-right: 0;
}
.hd-widget-tab.active {
  color: var(--hd-primary);
  border-bottom-color: var(--hd-primary);
}
.hd-widget-tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.hd-widget-tab-content.active {
  display: flex;
}

.hd-reply-preview {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-top: 1px solid var(--hd-border);
  background: var(--hd-bg-subtle);
  padding: 8px 12px;
}
.hd-reply-preview__body {
  flex: 1;
  min-width: 0;
}
.hd-reply-preview__title {
  font-size: 12px;
  line-height: 1.2;
  color: var(--hd-primary);
  font-weight: 700;
}
.hd-reply-preview__text {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--hd-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hd-reply-preview__close {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--hd-text-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 1px;
}
.hd-reply-preview__close:hover {
  background: var(--hd-bg-muted);
  color: var(--hd-text);
}

.hd-widget-input-area {
  padding: var(--hd-sp-3) var(--hd-sp-4);
  border-top: 1px solid var(--hd-border);
  display: flex;
  gap: var(--hd-sp-2);
  flex-shrink: 0;
}
.hd-widget-end-chat {
  align-self: flex-start;
  margin: 2px var(--hd-sp-4) 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--hd-text-subtle);
  font-size: 12px;
  line-height: 1.25;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color var(--hd-t-fast), opacity var(--hd-t-fast);
}
.hd-widget-end-chat:hover {
  color: var(--hd-primary);
}
.hd-widget-end-chat:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.hd-widget-input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius-full);
  background: var(--hd-bg-subtle);
  color: var(--hd-text);
  font: inherit;
  font-size: var(--hd-text-sm);
  transition: border-color var(--hd-t-fast);
}
.hd-widget-input:focus {
  outline: none;
  border-color: var(--hd-primary);
}
.hd-chat-input--textarea {
  min-height: 42px;
  max-height: 120px;
  resize: vertical;
  border-radius: var(--hd-radius-md);
  line-height: 1.45;
}
.hd-widget-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--hd-primary);
  color: var(--hd-text-on-primary);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--hd-t-fast);
}
.hd-widget-send:hover {
  background: var(--hd-primary-dark);
}
.hd-widget-send:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}
.hd-widget-send--secondary {
  background: var(--hd-bg-muted);
  color: var(--hd-text-muted);
  border: 1px solid var(--hd-border);
}
.hd-widget-send--secondary:hover {
  background: var(--hd-gray-200);
  color: var(--hd-text);
}
.hd-emoji-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.hd-emoji-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: min(300px, 72vw);
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--hd-radius-md);
  border: 1px solid var(--hd-border);
  background: var(--hd-bg);
  box-shadow: var(--hd-shadow-lg);
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}
.hd-emoji-item {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  width: 100%;
  min-height: 30px;
  padding: 3px 0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--hd-t-fast);
}
.hd-emoji-item:hover {
  background: var(--hd-bg-subtle);
  border-color: var(--hd-border);
}
.hd-emoji-item:focus {
  outline: none;
  border-color: var(--hd-primary);
  box-shadow: 0 0 0 2px var(--hd-primary-alpha);
}
.hd-widget-send--recording {
  background: var(--hd-danger);
  color: var(--hd-text-on-primary);
  border-color: transparent;
  animation: hdPulse 1.2s infinite;
}
.hd-widget-send--recording:hover {
  background: var(--hd-danger-dark);
  color: var(--hd-text-on-primary);
}
.hd-icon-spin {
  display: inline-block;
  animation: hdSpin 0.9s linear infinite;
}
.hd-files-hint {
  padding: 0 var(--hd-sp-4) var(--hd-sp-2);
  font-size: var(--hd-text-xs);
  color: var(--hd-text-muted);
  min-height: 20px;
}
.hd-audio-notice {
  margin: 6px var(--hd-sp-4) 0;
  border: 1px solid var(--hd-border);
  background: var(--hd-bg-subtle);
  color: var(--hd-text-muted);
  border-radius: var(--hd-radius);
  padding: 6px 10px;
  font-size: var(--hd-text-xs);
}
.hd-audio-notice.is-enabled {
  border-color: var(--hd-success-border);
  background: var(--hd-success-alpha);
  color: var(--hd-success);
}
.hd-widget-welcome {
  flex: 1;
  overflow-y: auto;
  padding: var(--hd-sp-6);
  padding-bottom: var(--hd-sp-8);
  text-align: center;
  color: var(--hd-text-muted);
}
.hd-widget-start-chat {
  margin-top: 6px;
  min-width: 172px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #6f18ff 0%, #9f2eff 55%, #5a0dff 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(111, 24, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition: transform var(--hd-t-fast), box-shadow var(--hd-t-fast), filter var(--hd-t-fast), opacity var(--hd-t-fast);
}
.hd-widget-start-chat:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 14px 28px rgba(111, 24, 255, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.38);
  filter: saturate(1.05);
}
.hd-widget-start-chat:active {
  transform: translateY(0) scale(0.99);
}
.hd-widget-start-chat:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(111, 24, 255, 0.2), 0 10px 22px rgba(111, 24, 255, 0.32);
}
.hd-widget-start-chat__icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.22);
  font-size: 13px;
}
.hd-widget-start-chat__label {
  white-space: nowrap;
}
.hd-widget-start-chat.is-loading {
  cursor: progress;
  pointer-events: none;
  opacity: 0.92;
}
.hd-widget-start-chat.is-loading .hd-widget-start-chat__icon {
  background: rgba(255, 255, 255, 0.18);
}
.hd-widget-start-chat.is-loading .hd-widget-start-chat__icon i {
  animation: hdSpin 0.9s linear infinite;
}
.hd-widget-start-chat[disabled] {
  cursor: not-allowed;
  opacity: 0.86;
}
.hd-widget-kb-results {
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}
.hd-widget-kb-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  text-align: left;
  line-height: 1.35;
  white-space: normal;
}
.hd-widget-kb-item:focus-visible {
  outline: none;
  border-color: var(--hd-primary);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.24);
}
.hd-widget-kb-item__title,
.hd-widget-kb-item__summary,
.hd-widget-kb-item__meta {
  width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.hd-widget-kb-item__title {
  font-size: 13px;
  color: var(--hd-text);
}
.hd-widget-kb-item__summary {
  font-size: 12px;
  color: var(--hd-text-muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.hd-widget-kb-item__meta {
  font-size: 11px;
  color: var(--hd-text-subtle);
}
.hd-widget-kb-article {
  margin-top: 8px;
}
.hd-widget-offline-notice {
  font-size: 13px;
  color: var(--hd-text-default);
  margin: 0 0 8px;
  line-height: 1.55;
  background: var(--hd-bg-subtle);
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  padding: 10px 12px;
}
.hd-widget-offline-notice p {
  margin: 0 0 8px;
}
.hd-widget-offline-notice p:last-child {
  margin-bottom: 0;
}
.hd-widget-offline-notice a {
  color: var(--hd-primary);
  font-weight: 700;
  text-decoration: underline;
  word-break: break-word;
}
.hd-kb-article-content img,
.hd-kb-article-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--hd-radius);
  border: 1px solid var(--hd-border);
  display: block;
  margin: 8px 0;
  cursor: zoom-in;
}
.hd-kb-article-content iframe,
.hd-kb-article-video {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 200px;
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  background: #000;
  margin: 10px 0;
}
.hd-widget-ticket-list {
  display: flex;
  flex-direction: column;
  gap: var(--hd-sp-2);
  padding: var(--hd-sp-4);
  overflow-y: auto;
}
.hd-widget-csat {
  padding: var(--hd-sp-5);
  text-align: center;
  border-top: 1px solid var(--hd-border);
  border-bottom: 1px solid var(--hd-border);
  background: var(--hd-bg-subtle);
}
.hd-widget-csat__prompt {
  font-size: var(--hd-text-sm);
  font-weight: 700;
  color: var(--hd-text);
  margin: 0 0 var(--hd-sp-3);
}
.hd-star-rating {
  display: flex;
  justify-content: center;
  gap: 4px;
}
.hd-star-rating button {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--hd-gray-300);
  cursor: pointer;
  transition: color var(--hd-t-fast), transform var(--hd-t-fast);
  line-height: 1;
}
.hd-star-rating button:hover,
.hd-star-rating button.active {
  color: var(--hd-warning);
  transform: scale(1.12);
}
.hd-widget-csat__thanks {
  font-size: var(--hd-text-sm);
  color: var(--hd-success);
  font-weight: 600;
  margin: 0;
}

/* ---- CSAT Modal ---- */
.hd-csat-modal .hd-csat-emojis {
  display: flex;
  justify-content: center;
  gap: var(--hd-sp-3);
  margin: var(--hd-sp-5) 0;
}
.hd-csat-emoji {
  width: 52px;
  height: 52px;
  border-radius: var(--hd-radius-md);
  border: 2px solid transparent;
  background: var(--hd-bg-muted);
  cursor: pointer;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--hd-t-base);
}
.hd-csat-emoji:hover {
  transform: scale(1.15);
  border-color: var(--hd-border-strong);
}
.hd-csat-emoji.selected {
  border-color: var(--hd-primary);
  background: var(--hd-primary-alpha);
  transform: scale(1.12);
}
.hd-csat-label {
  text-align: center;
  font-size: var(--hd-text-xs);
  color: var(--hd-text-muted);
  margin-top: var(--hd-sp-2);
  height: 18px;
}
.hd-csat-success {
  text-align: center;
  padding: var(--hd-sp-8) var(--hd-sp-6);
  animation: hdFadeIn var(--hd-t-base);
}
.hd-csat-success-icon {
  font-size: 48px;
  margin-bottom: var(--hd-sp-3);
}
.hd-csat-success-text {
  font-size: var(--hd-text-lg);
  font-weight: 700;
  color: var(--hd-text);
}

/* ---- Admin pages ---- */
.hd-admin-page {
  display: flex;
  flex-direction: column;
  gap: var(--hd-sp-5);
}
.hd-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--hd-sp-4);
  flex-wrap: wrap;
}
.hd-dashboard-grid {
  display: grid;
  gap: var(--hd-sp-5);
}
.hd-kpi-grid {
  grid-template-columns: repeat(4, 1fr);
}
.hd-chart-grid {
  grid-template-columns: 1fr 1fr;
}
.hd-chart-card {
  padding: var(--hd-sp-5);
  min-height: 320px;
}
.hd-chart-wrap {
  position: relative;
  height: 260px;
}
.hd-filter-bar {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: var(--hd-sp-2);
}
.hd-filter-inline {
  display: flex;
  align-items: center;
  gap: var(--hd-sp-2);
}
#hdChatHeader {
  display: block;
  width: 100%;
}
.hd-chat-header-meta {
  display: block;
  margin-top: 4px;
  color: var(--hd-text-muted);
}
.hd-chat-head {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hd-chat-head__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}
.hd-chat-head__identity {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.hd-chat-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--hd-sp-2);
  min-width: 0;
}
.hd-chat-head__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
}
.hd-chat-head__side .hd-chat-timers {
  max-width: none;
  justify-content: flex-end;
}
#hdChatTagsBadges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hd-chat-head__controls--inline {
  margin-top: 0;
}
.hd-chat-head__controls {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.hd-chat-timers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 760px;
}
.hd-chat-timer {
  padding: 8px 10px;
  border: 1px solid var(--hd-border);
  border-radius: 8px;
  background: var(--hd-bg-subtle);
}
.hd-chat-timer small {
  display: block;
  color: var(--hd-text-subtle);
  font-size: 11px;
  line-height: 1.3;
}
.hd-chat-timer__value {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  line-height: 1;
  color: var(--hd-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hd-chat-header-controls {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(280px, 1fr);
  align-items: center;
}
.hd-chat-header-controls > .hd-select {
  width: 100%;
  min-width: 0;
}
.hd-input-action {
  position: relative;
  width: 100%;
  min-width: 0;
}
.hd-input-action__input {
  padding-right: 44px;
}
.hd-input-action__btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--hd-radius);
  background: var(--hd-primary);
  color: var(--hd-text-on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--hd-t-fast), opacity var(--hd-t-fast);
}
.hd-input-action__btn:hover {
  background: var(--hd-primary-dark);
}
.hd-input-action__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.hd-input--saving {
  opacity: 0.7;
}
.hd-ticket-view {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--hd-sp-5);
  height: calc(100vh - 120px);
}
.hd-ticket-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hd-ticket-sidebar {
  overflow-y: auto;
}
.hd-ticket-sidebar .hd-card__header {
  overflow: hidden;
}
.hd-ticket-sidebar .hd-pill-tabs {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}
.hd-ticket-sidebar .hd-pill-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hd-ticket-side-summary {
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  padding: 12px;
  background: var(--hd-bg-subtle);
  margin-bottom: 10px;
}
.hd-ticket-side-summary__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.hd-ticket-side-summary__code {
  color: var(--hd-text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.hd-ticket-side-summary__subject {
  color: var(--hd-text);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
}
.hd-ticket-side-summary__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.hd-ticket-side-summary__badges .hd-badge {
  font-size: 12px;
}
.hd-ticket-side-summary__tag-empty {
  color: var(--hd-text-subtle);
  font-size: 12px;
  font-weight: 600;
  align-self: center;
}
.hd-ticket-side-summary__timers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.hd-ticket-side-summary__timer {
  border: 1px solid var(--hd-border);
  border-radius: 10px;
  background: var(--hd-bg);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hd-ticket-side-summary__timer-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--hd-text-subtle);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hd-ticket-side-summary__timer-value {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 800;
}
.hd-ticket-side-summary__timer--open .hd-ticket-side-summary__timer-value {
  color: var(--hd-primary);
}
.hd-ticket-side-summary__timer--total .hd-ticket-side-summary__timer-value {
  color: var(--hd-warning);
}
.hd-ticket-side-summary__note {
  margin-top: 8px;
  color: var(--hd-text-subtle);
  font-size: 12px;
  line-height: 1.35;
}
.hd-chat-monitor {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 120px);
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius-md);
  overflow: hidden;
}
.hd-chat-list {
  border-right: 1px solid var(--hd-border);
  overflow-y: auto;
}
.hd-chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.hd-chat-main .hd-widget-input-area {
  align-items: flex-end;
}
.hd-chat-main .hd-messages {
  min-height: 0;
}

/* Compact header on admin live chat to free vertical space for messages */
.hd-admin-page--chat #hdChatHeader.hd-card__header {
  padding: 8px 12px;
}
.hd-admin-page--chat .hd-chat-head {
  gap: 4px;
}
.hd-admin-page--chat .hd-chat-head__top {
  gap: 8px;
}
.hd-admin-page--chat .hd-chat-head__actions {
  gap: 6px;
}
.hd-admin-page--chat #hdChatHeader .hd-card__title {
  margin: 0;
  line-height: 1.15;
  font-size: 16px;
}
.hd-admin-page--chat #hdChatHeader .hd-chat-header-meta {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
}
.hd-admin-page--chat #hdChatTagsBadges {
  margin-top: 0;
  gap: 4px;
}
.hd-admin-page--chat .hd-chat-head__controls {
  gap: 6px;
}
.hd-admin-page--chat .hd-chat-head__controls .hd-input {
  padding-top: 7px;
  padding-bottom: 7px;
}
.hd-admin-page--chat .hd-input-action__btn {
  width: 28px;
  height: 28px;
  right: 5px;
}
.hd-admin-page--chat .hd-chat-timers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}
.hd-admin-page--chat .hd-chat-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-radius: 7px;
}
.hd-admin-page--chat .hd-chat-timer small {
  display: inline;
  font-size: 9px;
  line-height: 1;
  margin: 0;
}
.hd-admin-page--chat .hd-chat-timer__value {
  display: inline;
  margin-top: 0;
  font-size: 14px;
  line-height: 1;
}
.hd-admin-page--chat #hdChatMessages.hd-messages {
  padding: 12px 14px;
}
.hd-admin-page--ticket {
  height: calc(100vh - 78px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.hd-admin-page--ticket > [data-hd-ticket-view-top] {
  flex: 0 0 auto;
}
.hd-admin-page--ticket .hd-ticket-view {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  gap: 12px;
}
.hd-admin-page--ticket .hd-ticket-main {
  min-height: 0;
}
.hd-admin-page--ticket #hdAdminMessages.hd-messages {
  padding-top: 12px;
  padding-bottom: 12px;
}
.hd-admin-page--chat {
  height: calc(100vh - 120px);
  overflow: hidden;
}
.hd-chat-lock-scroll,
.hd-chat-lock-scroll body {
  overflow: hidden !important;
  height: 100%;
}
.hd-admin-page--chat > .hd-filter-inline {
  flex-shrink: 0;
}
.hd-admin-page--chat .hd-chat-monitor {
  height: 100%;
  min-height: 0;
}
.hd-chat-monitor--3col {
  grid-template-columns: 300px minmax(0, 1fr) 340px;
  background: var(--hd-bg);
}
.hd-chat-monitor--3col .hd-chat-list,
.hd-chat-monitor--3col .hd-chat-main,
.hd-chat-monitor--3col .hd-chat-sidebar {
  background: var(--hd-bg);
}
.hd-chat-monitor--3col .hd-chat-main {
  border-left: 1px solid var(--hd-border);
  border-right: 1px solid var(--hd-border);
}
.hd-chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-height: 0;
  overflow-y: auto;
}
.hd-chat-sidebar__section {
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  background: var(--hd-bg);
  padding: 12px;
}
.hd-chat-sidebar__title {
  margin: 0;
  font-size: var(--hd-text-sm);
  font-weight: 700;
  color: var(--hd-text);
}
.hd-chat-sidebar__list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}
.hd-chat-user {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.hd-chat-user__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--hd-bg-muted);
  color: var(--hd-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.hd-chat-user__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hd-chat-user__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.hd-chat-user__meta strong {
  color: var(--hd-text);
  font-size: var(--hd-text-sm);
}
.hd-chat-user__meta span,
.hd-chat-user__meta small {
  color: var(--hd-text-muted);
  font-size: var(--hd-text-xs);
  line-height: 1.35;
}
#hdChatSidebarUser .hd-chat-user {
  justify-content: center;
}
#hdChatSidebarUser .hd-chat-user__meta {
  align-items: center;
  text-align: center;
  width: 100%;
}
#hdChatSidebarUser .hd-chat-user__meta small {
  display: block;
}
#hdChatSidebarUser .hd-copy-client-id {
  display: inline-flex;
  margin: 4px auto 2px;
}
#hdChatSidebarUser .hd-chat-user__name-link {
  display: inline-flex;
  align-items: center;
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}
#hdChatSidebarUser .hd-chat-user__name-link:hover {
  text-decoration: underline;
}
#hdChatSidebarUser .hd-chat-user__actions {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 4px 0 2px;
}
#hdChatSidebarUser .hd-chat-user__actions .hd-btn {
  margin: 0 auto;
}
.hd-chat-note-item {
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  padding: 10px;
  background: var(--hd-bg-subtle);
}
.hd-chat-note-item p {
  margin: 0 0 6px;
  color: var(--hd-text);
  font-size: var(--hd-text-sm);
  white-space: pre-wrap;
}
.hd-chat-note-item small {
  color: var(--hd-text-subtle);
  font-size: 11px;
}
.hd-kb-active-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  width: fit-content;
  margin-top: 2px;
}
.hd-kb-active-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.hd-kb-active-switch__track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--hd-bg-muted);
  border: 1px solid var(--hd-border);
  position: relative;
  transition: all var(--hd-t-fast);
}
.hd-kb-active-switch__thumb {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background: var(--hd-surface-inverse);
  transition: transform var(--hd-t-fast);
}
.hd-kb-active-switch__text {
  font-size: 13px;
  font-weight: 600;
  color: var(--hd-text);
}
.hd-kb-active-switch.active .hd-kb-active-switch__track,
.hd-kb-active-switch input:checked + .hd-kb-active-switch__track {
  background: var(--hd-primary-alpha);
  border-color: var(--hd-primary);
}
.hd-kb-active-switch.active .hd-kb-active-switch__thumb,
.hd-kb-active-switch input:checked + .hd-kb-active-switch__track .hd-kb-active-switch__thumb {
  transform: translateX(20px);
  background: var(--hd-primary);
}
.hd-note-mention-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--hd-primary-alpha-strong);
  background: var(--hd-primary-alpha-soft);
  color: var(--hd-primary);
  font-weight: 700;
  line-height: 1.4;
}
.hd-user-note-field {
  position: relative;
}
.hd-note-mentions-hint {
  margin: 6px 0 0;
  color: var(--hd-text-muted);
  font-size: 11px;
  line-height: 1.35;
}
.hd-note-mentions-hint strong {
  color: var(--hd-primary);
}
.hd-note-mentions {
  position: relative;
  margin-top: 6px;
  border: 1px solid var(--hd-border);
  border-radius: 12px;
  background: var(--hd-bg);
  box-shadow: 0 12px 28px rgba(17, 13, 38, 0.12);
  max-height: 260px;
  padding: 6px;
  overflow-y: auto;
  z-index: 8;
}
.hd-note-mention-option {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px;
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  color: var(--hd-text);
  transition: background var(--hd-t-fast), box-shadow var(--hd-t-fast), transform var(--hd-t-fast);
}
.hd-note-mention-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--hd-primary-alpha-soft);
  color: var(--hd-primary);
  border: 1px solid var(--hd-primary-alpha-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  overflow: hidden;
}
.hd-note-mention-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hd-note-mention-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hd-note-mention-main {
  color: var(--hd-text);
  font-size: var(--hd-text-sm);
  font-weight: 700;
  line-height: 1.35;
}
.hd-note-mention-sub {
  color: var(--hd-text-muted);
  font-size: 12px;
  line-height: 1.3;
}
.hd-note-mention-chips {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.hd-note-mention-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--hd-border);
  color: var(--hd-text-muted);
  background: var(--hd-bg-subtle);
  line-height: 1.25;
}
.hd-note-mention-chip.is-agent {
  color: var(--hd-primary);
  border-color: var(--hd-primary-alpha-strong);
  background: var(--hd-primary-alpha-soft);
}
.hd-note-mention-chip.is-leader {
  color: #0f7ad8;
  border-color: rgba(15, 122, 216, 0.26);
  background: rgba(15, 122, 216, 0.1);
}
.hd-note-mention-chip.is-online {
  color: var(--hd-success);
  border-color: rgba(15, 158, 88, 0.25);
  background: rgba(15, 158, 88, 0.12);
}
.hd-note-mention-chip.is-offline {
  color: var(--hd-text-muted);
  border-color: var(--hd-border);
  background: var(--hd-bg-subtle);
}
.hd-note-mention-chip.is-load {
  color: var(--hd-text-subtle);
  border-color: var(--hd-border);
  background: transparent;
}
.hd-note-mention-option:hover,
.hd-note-mention-option.is-active {
  background: var(--hd-primary-alpha-soft);
  box-shadow: inset 0 0 0 1px var(--hd-primary-alpha-strong);
}
.hd-note-mention-option.is-active {
  transform: translateX(1px);
}
.hd-chat-history-item {
  display: block;
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  padding: 10px;
  background: var(--hd-bg);
  text-decoration: none;
  transition: background var(--hd-t-fast), border-color var(--hd-t-fast);
}
.hd-chat-history-item:hover {
  background: var(--hd-bg-subtle);
  border-color: var(--hd-border-strong);
}
.hd-chat-history-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.hd-chat-history-item__top strong {
  color: var(--hd-text);
  font-size: var(--hd-text-sm);
}
.hd-chat-history-item p {
  margin: 0 0 4px;
  color: var(--hd-text);
  font-size: var(--hd-text-sm);
  line-height: 1.35;
}
.hd-chat-history-item small {
  color: var(--hd-text-subtle);
  font-size: 11px;
}
.hd-conversation-history-modal__messages {
  max-height: min(68vh, 620px);
  min-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  background: var(--hd-bg-subtle);
  padding: var(--hd-sp-4);
}
.hd-chat-workspace-modal {
  width: min(1760px, calc(100vw - 12px));
  max-width: min(1760px, calc(100vw - 12px));
  max-height: calc(100vh - 12px);
  height: calc(100vh - 12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.hd-chat-workspace-modal .hd-modal__header {
  padding: 7px 12px;
}
.hd-chat-workspace-modal .hd-modal__header small {
  display: none;
}
.hd-chat-workspace-modal__body {
  padding: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  background: var(--hd-bg);
}
.hd-chat-workspace-modal__body .hd-chat-main {
  flex: 1;
  min-height: 0;
  height: 100%;
  border: 0;
}
.hd-chat-workspace-modal__body #hdChatHeader.hd-card__header {
  border-top: 0;
}
.hd-chat-workspace-modal__body #hdChatMessages.hd-messages {
  padding: 8px 12px;
}
#hdChatWorkspaceModal {
  position: fixed !important;
  inset: 0;
  z-index: 100500 !important;
  padding: 6px !important;
  align-items: stretch;
  justify-content: center;
}
#hdChatWorkspaceModal.open {
  z-index: 100500 !important;
}
body.hd-chat-workspace-open {
  overflow: hidden !important;
}
.hd-chat-main--expanded #hdChatHeader.hd-card__header {
  padding: 5px 8px;
}
.hd-chat-main--expanded .hd-chat-head {
  gap: 3px;
}
.hd-chat-main--expanded .hd-chat-head__top {
  gap: 6px;
}
.hd-chat-main--expanded .hd-chat-head__identity .hd-card__title {
  font-size: 14px;
}
.hd-chat-main--expanded .hd-chat-header-meta {
  font-size: 10px;
}
.hd-chat-main--expanded .hd-chat-head__actions {
  gap: 5px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}
.hd-chat-main--expanded .hd-chat-head__actions > * {
  flex: 0 0 auto;
}
.hd-chat-main--expanded .hd-chat-head__actions .hd-btn {
  padding: 5px 8px;
  font-size: 11px;
}
.hd-chat-main--expanded .hd-chat-head__controls {
  gap: 5px;
  grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
}
.hd-chat-main--expanded .hd-chat-head__controls .hd-input {
  padding-top: 6px;
  padding-bottom: 6px;
}
.hd-chat-main--expanded .hd-chat-timers {
  gap: 5px;
}
.hd-chat-main--expanded .hd-chat-timer {
  padding: 2px 6px;
}
.hd-chat-main--expanded .hd-chat-timer small {
  font-size: 8px;
}
.hd-chat-main--expanded .hd-chat-timer__value {
  font-size: 12px;
}
.hd-chat-main--expanded #hdChatQuickReplyBar {
  padding: 6px 10px !important;
}
.hd-chat-main--expanded .hd-widget-input-area {
  padding: 8px 10px;
}
.hd-audio-rec-state {
  padding: 6px 12px 0;
  color: var(--hd-text-muted);
  font-size: var(--hd-text-xs);
  line-height: 1.3;
}
.hd-audio-rec-state.is-recording {
  color: var(--hd-danger);
  font-weight: 700;
}
.hd-audio-rec-state.is-ready {
  color: var(--hd-primary);
}
.hd-audio-rec-state.is-sending {
  color: var(--hd-warning);
}
.hd-chat-session-item {
  border-bottom: 1px solid var(--hd-border);
  padding: var(--hd-sp-3);
  cursor: pointer;
  transition: background var(--hd-t-fast);
}
.hd-chat-session-item.is-favorite {
  box-shadow: inset 3px 0 0 var(--hd-primary);
}
.hd-chat-session-item:hover,
.hd-chat-session-item.active {
  background: var(--hd-bg-subtle);
}
.hd-chat-session-item.waiting .hd-badge-dot {
  animation: hdPulse 1.2s infinite;
}
.hd-chat-session-item__top-right {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
}
.hd-chat-favorite-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--hd-text-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--hd-t-fast);
  padding: 2px;
  line-height: 1;
  font-size: 18px;
}
.hd-chat-favorite-btn:hover {
  color: var(--hd-primary);
}
.hd-chat-favorite-btn.is-favorite {
  color: var(--hd-primary);
}
.hd-chat-favorite-btn.is-loading {
  opacity: 0.65;
  pointer-events: none;
}
.hd-chat-favorite-btn--header {
  font-size: 20px;
  margin-right: 2px;
}
.hd-urgent-row {
  border-left: 3px solid var(--hd-danger);
}
.hd-overdue {
  color: var(--hd-danger);
  font-weight: 700;
}
.hd-progress {
  height: 10px;
  border-radius: var(--hd-radius-full);
  background: var(--hd-bg-muted);
  overflow: hidden;
}
.hd-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--hd-primary), var(--hd-primary-light));
}
.hd-emoji-row {
  display: grid;
  grid-template-columns: 90px 1fr 52px;
  align-items: center;
  gap: var(--hd-sp-2);
  font-size: var(--hd-text-sm);
}
.hd-sortable-item {
  padding: var(--hd-sp-3);
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  background: var(--hd-bg);
  cursor: move;
}
.hd-sortable-item.dragging {
  opacity: 0.55;
}
.hd-admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--hd-danger);
  color: var(--hd-text-on-primary);
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}
.hd-qr-dropdown {
  background: var(--hd-bg);
  border: 1px solid var(--hd-border);
  border-radius: var(--hd-radius);
  box-shadow: var(--hd-shadow-lg);
  z-index: 9999;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.hd-qr-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 1px solid var(--hd-border);
  transition: background var(--hd-t-fast);
}
.hd-qr-item:last-child {
  border-bottom: none;
}
.hd-qr-item:hover {
  background: var(--hd-bg-subtle);
}
.hd-qr-item.is-active {
  background: var(--hd-primary-alpha);
}
.hd-qr-item strong {
  font-size: 13px;
  color: var(--hd-text);
  font-weight: 600;
}
.hd-qr-item span {
  font-size: 12px;
  color: var(--hd-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hd-kb-mark {
  background: var(--hd-highlight);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}
.hd-heatmap {
  display: grid;
  grid-template-columns: 32px repeat(24, minmax(18px, 1fr));
  gap: 2px;
  font-size: 10px;
  min-width: 620px;
}
.hd-heatmap__label {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hd-text-muted);
  font-weight: 600;
}
.hd-heatmap__cell {
  aspect-ratio: 1;
  min-height: 14px;
  border-radius: 3px;
  background: var(--hd-gray-100);
  position: relative;
  transition: transform var(--hd-t-fast), filter var(--hd-t-fast);
}
.hd-heatmap__cell:hover {
  transform: translateY(-1px);
  filter: saturate(1.1);
}
.hd-timeline {
  position: relative;
  padding-left: 20px;
}
.hd-timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--hd-border);
}
.hd-timeline-event {
  position: relative;
  margin-bottom: var(--hd-sp-4);
}
.hd-timeline-event::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hd-primary);
  border: 2px solid var(--hd-bg);
}
.hd-timeline-event__text {
  color: var(--hd-text);
  line-height: 1.4;
  font-size: var(--hd-text-sm);
}
.hd-timeline-event__time {
  color: var(--hd-text-muted);
  font-size: 11px;
  margin-top: 2px;
}
.hd-collision-banner {
  display: flex;
  align-items: center;
  gap: var(--hd-sp-2);
  padding: 8px 14px;
  background: var(--hd-warning-alpha);
  border: 1px solid var(--hd-warning);
  border-radius: var(--hd-radius);
  font-size: var(--hd-text-sm);
  color: var(--hd-warning);
  font-weight: 600;
}

@keyframes hdSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes hdFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes hdSlideRight {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes hdPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@keyframes hdWidgetPulse {
  0%,
  100% {
    box-shadow: var(--hd-widget-pulse-shadow);
  }
  50% {
    box-shadow: var(--hd-widget-pulse-shadow-strong);
  }
}
@keyframes hdSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
@keyframes hdTyping {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}
@keyframes hdTypingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .hd-kb-layout {
    grid-template-columns: 1fr;
  }
  .hd-kb-results {
    max-height: 320px;
    min-height: 220px;
  }
  .hd-kb-article-card .hd-card__body {
    min-height: 360px;
  }
  .hd-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hd-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hd-ticket-detail-layout {
    grid-template-columns: 1fr;
  }
  .hd-chat-monitor--3col {
    grid-template-columns: 260px minmax(0, 1fr) 300px;
  }
  .hd-chat-head__top {
    grid-template-columns: 1fr;
  }
  .hd-chat-head__actions {
    justify-content: flex-start;
  }
  .hd-chat-head__side {
    align-items: stretch;
  }
  .hd-chat-head__side .hd-chat-timers {
    justify-content: flex-start;
  }
  .hd-chat-head__controls {
    width: 100%;
    grid-template-columns: 1fr;
  }
  .hd-chat-timers {
    max-width: 100%;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

@media (max-width: 768px) {
  .hd-client-layout {
    padding: var(--hd-sp-5);
  }
  .hd-ticket-detail-layout #hdTicketMessages.hd-messages {
    min-height: 220px;
    max-height: 52vh;
    padding: var(--hd-sp-4);
  }
  .hd-chat-lock-scroll,
  .hd-chat-lock-scroll body {
    overflow: auto !important;
    height: auto;
  }
  .hd-admin-page--chat {
    height: auto;
    overflow: visible;
  }
  .hd-admin-page--ticket {
    height: auto;
    overflow: visible;
  }
  .hd-ticket-view {
    grid-template-columns: 1fr;
    height: auto;
  }
  .hd-chat-monitor {
    grid-template-columns: 1fr;
    height: auto;
  }
  .hd-chat-list {
    border-right: 0;
    border-bottom: 1px solid var(--hd-border);
    max-height: 280px;
  }
  .hd-chat-monitor--3col {
    grid-template-columns: 1fr;
  }
  .hd-chat-sidebar {
    border-top: 1px solid var(--hd-border);
    max-height: 320px;
  }
  .hd-chat-workspace-modal {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .hd-chat-main--expanded .hd-chat-head__top {
    grid-template-columns: 1fr;
  }
  .hd-chat-main--expanded .hd-chat-head__controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .hd-kpi-grid,
  .hd-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .hd-msg-reply-action {
    opacity: 0.92;
    pointer-events: auto;
    transform: none;
  }
  .hd-widget-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: min(88dvh, 760px);
    max-height: min(88dvh, 760px);
    border-top-left-radius: 1.1rem;
    border-top-right-radius: 1.1rem;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: var(--hd-mobile-panel-shadow);
    transform-origin: bottom center;
    transform: translateY(105%);
  }
  .hd-widget-panel.hd-widget-panel--expanded {
    width: 100vw;
    height: min(88dvh, 760px);
    max-height: min(88dvh, 760px);
  }
  .hd-widget-expand {
    display: none !important;
  }
  .hd-widget-panel.open {
    transform: translateY(0);
  }
  .hd-widget-header {
    position: sticky;
    top: 0;
    z-index: 2;
    border-top-left-radius: 1.1rem;
    border-top-right-radius: 1.1rem;
    padding-top: calc(var(--hd-sp-4) + env(safe-area-inset-top, 0px));
  }
  .hd-widget-input-area {
    padding-bottom: calc(var(--hd-sp-3) + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 480px) {
  .hd-widget-panel {
    width: 100vw;
  }
  .hd-notify {
    right: 12px;
    bottom: calc(16px + 62px + 10px);
    width: calc(100vw - 24px);
    max-width: 360px;
  }
  .hd-widget-btn {
    bottom: 16px;
    right: 16px;
  }
}
