/* ═══════════════════════════════════════════════════════════════════════════
   chat.css  —  Voetris Live Chat
   Section 1: shop widget  (.cw-*)
   Section 2: admin dashboard  (.ac-*)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ╔═══════════════════════════════════════════════════════════════════════════
   ║  (1)  SHOP WIDGET
   ╚═══════════════════════════════════════════════════════════════════════════ */

/* ── Root widget wrapper ───────────────────────────────────────────────────── */
.cw {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9990;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  /* Isolate from page resets */
  color: #111;
  -webkit-font-smoothing: antialiased;
}

/* ── Backdrop (mobile — click outside to close) ───────────────────────────── */
.cw-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: -1;
  cursor: pointer;
}
.cw-backdrop--visible { display: block; }
/* Never show backdrop on desktop */
@media (min-width: 481px) {
  .cw-backdrop { display: none !important; }
}

/* ── Floating action button ────────────────────────────────────────────────── */
.cw-fab {
  position: relative;
  width: 58px; height: 58px;
  background: #1b1d1f; color: #fff;
  border: none; border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25), 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  /* Ensure the FAB is always on top — close button must not be blocked */
  z-index: 2;
}
.cw-fab:hover  { transform: scale(1.07); box-shadow: 0 6px 26px rgba(0,0,0,0.3); }
.cw-fab:active { transform: scale(0.95); }
.cw-fab:focus-visible { outline: 3px solid rgba(27,29,31,0.4); outline-offset: 3px; }

/* FAB icons — chat icon shown by default, X shown when open */
.cw-fab-icon {
  width: 26px; height: 26px;
  position: absolute;
  transition: opacity 0.15s ease, transform 0.2s ease;
  pointer-events: none; /* icons must not capture clicks */
}
.cw-fab-icon--chat  { opacity: 1; transform: scale(1) rotate(0deg); }
.cw-fab-icon--close { opacity: 0; transform: scale(0.4) rotate(-90deg); }

.cw-fab--open .cw-fab-icon--chat  { opacity: 0; transform: scale(0.4) rotate(90deg); }
.cw-fab--open .cw-fab-icon--close { opacity: 1; transform: scale(1) rotate(0deg); }

/* Unread badge */
.cw-fab-badge {
  display: none;
  position: absolute; top: -3px; right: -3px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: #ef4444; color: #fff;
  border-radius: 10px; border: 2px solid #fff;
  font-size: 11px; font-weight: 700; line-height: 16px;
  text-align: center;
  pointer-events: none;
  animation: cw-badge-pop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes cw-badge-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Panel ─────────────────────────────────────────────────────────────────── */
/*
 * ROOT FIX: display:none by default.
 * Previous version had display:flex here which overrides [hidden]
 * because class selectors beat user-agent stylesheet rules.
 * Now we toggle .cw-panel--open to show the panel.
 */
.cw-panel {
  display: none;              /* ← CRITICAL: hidden until .cw-panel--open added */
  flex-direction: column;
  position: absolute;
  bottom: 70px; right: 0;
  width: 360px;
  max-height: 580px;
  background: #fff;
  border-radius: 18px;
  box-shadow:
    0 12px 48px rgba(0,0,0,0.18),
    0 4px 12px rgba(0,0,0,0.08),
    0 0 0 1px rgba(0,0,0,0.04);
  overflow: hidden;
  /* Sit above the FAB so the close button always works */
  z-index: 10;
}

/* Only show (and animate) when this class is present */
.cw-panel--open {
  display: flex;
  animation: cw-slide-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cw-slide-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.cw-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 14px 16px;
  background: #1b1d1f; color: #fff;
  flex-shrink: 0;
}
.cw-header-left { display: flex; align-items: center; gap: 12px; }

.cw-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cw-avatar svg { width: 22px; height: 22px; }

.cw-header-name   { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; display: block; }
.cw-header-status { display: flex; align-items: center; gap: 6px; margin-top: 3px; }

.cw-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6b7280; flex-shrink: 0;
  transition: background 0.3s;
}
.cw-dot--online  { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.3); }
.cw-dot--offline { background: #6b7280; }

#cw-status-text { font-size: 12px; color: rgba(255,255,255,0.65); }

/*
 * Close button — MUST be visually accessible and not blocked by anything.
 * Explicit z-index, large hit area, pointer-events:auto.
 */
.cw-close {
  position: relative;
  width: 34px; height: 34px;
  padding: 0;
  background: rgba(255,255,255,0.1);
  border: none; border-radius: 8px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  pointer-events: auto;  /* belt and braces */
  z-index: 20;           /* above everything inside the panel */
}
.cw-close:hover { background: rgba(255,255,255,0.2); color: #fff; }
.cw-close:active { background: rgba(255,255,255,0.3); }
.cw-close:focus-visible { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 2px; }
.cw-close svg { width: 16px; height: 16px; pointer-events: none; }

/* ── Shared body area ─────────────────────────────────────────────────────── */
.cw-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ── Pre-chat form ────────────────────────────────────────────────────────── */
.cw-prechat { padding: 20px; }

.cw-prechat-headline {
  margin: 0 0 4px;
  font-size: 16px; font-weight: 700; color: #111;
}
.cw-prechat-sub {
  margin: 0 0 18px;
  font-size: 13px; color: #6b7280;
}

.cw-logged-in-badge {
  display: flex; align-items: center; gap: 8px;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 14px;
  font-size: 13px; color: #166534;
}
.cw-logged-in-badge svg { width: 16px; height: 16px; flex-shrink: 0; }

.cw-field { margin-bottom: 12px; }

.cw-label {
  display: block;
  font-size: 12px; font-weight: 600; color: #374151;
  margin-bottom: 5px;
}
.cw-req { color: #ef4444; }

.cw-input,
.cw-textarea {
  width: 100%; box-sizing: border-box;
  padding: 9px 12px;
  border: 1.5px solid #e5e7eb; border-radius: 9px;
  font-size: 14px; font-family: inherit; color: #111;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none; -webkit-appearance: none;
  resize: none;
}
.cw-input:focus,
.cw-textarea:focus {
  outline: none;
  border-color: #1b1d1f;
  box-shadow: 0 0 0 3px rgba(27,29,31,0.08);
}
.cw-textarea { min-height: 80px; }

.cw-error {
  display: none;
  padding: 9px 12px; margin-bottom: 12px;
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px;
  font-size: 13px; color: #dc2626;
}

.cw-start-btn {
  width: 100%; padding: 11px 20px;
  background: #1b1d1f; color: #fff;
  border: none; border-radius: 10px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, transform 0.1s;
}
.cw-start-btn:hover    { background: #2d3139; }
.cw-start-btn:active   { transform: scale(0.98); }
.cw-start-btn:disabled { opacity: 0.6; cursor: wait; }
.cw-start-btn svg      { width: 16px; height: 16px; pointer-events: none; }

/* ── Message thread ───────────────────────────────────────────────────────── */
/*
 * overflow:hidden on the thread is critical — it lets .cw-messages flex-grow
 * and scroll independently while the closed banner and footer stay pinned.
 */
.cw-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0; /* needed for flex children to scroll in Safari */
}

.cw-messages {
  padding: 14px 14px 4px;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto; flex: 1;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  min-height: 0; /* Safari flex-scroll fix */
}

/* Message rows */
.cw-msg           { display: flex; }
.cw-msg--visitor  { justify-content: flex-end; }
.cw-msg--agent    { justify-content: flex-start; }
.cw-msg--system   { justify-content: center; padding: 4px 0; }

.cw-bwrap {
  display: flex; flex-direction: column;
  max-width: 82%;
}
.cw-msg--visitor .cw-bwrap { align-items: flex-end; }
.cw-msg--agent   .cw-bwrap { align-items: flex-start; }

.cw-sender {
  font-size: 11px; font-weight: 600; color: #9ca3af;
  margin-bottom: 3px; padding: 0 2px;
}

.cw-bubble {
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 14px; line-height: 1.55;
  word-break: break-word; white-space: pre-wrap;
  max-width: 100%;
}
.cw-bubble--visitor {
  background: #1b1d1f; color: #fff;
  border-bottom-right-radius: 5px;
}
.cw-bubble--agent {
  background: #f3f4f6; color: #111;
  border-bottom-left-radius: 5px;
}
.cw-bubble--system {
  background: #f0f9ff; color: #0369a1;
  font-size: 12px; border-radius: 20px;
  padding: 6px 14px; text-align: center;
}

.cw-msg-meta {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px; padding: 0 2px;
}
.cw-time { font-size: 10px; color: #d1d5db; }

/* ── Seen / Read receipt indicators ──────────────────────────────────────── */
.cw-msg-status {
  display: flex; align-items: center; gap: 3px;
  font-size: 10px; color: #d1d5db;
  margin-top: 3px; padding: 0 2px;
  transition: color 0.3s;
}
.cw-msg-status svg  { width: 13px; height: 13px; flex-shrink: 0; }
.cw-msg-status.seen { color: #22c55e; }
.cw-msg-status.read { color: #60a5fa; }

/* Admin side seen/read receipt */
.acm-status {
  font-size: 10px; color: #d1d5db;
  margin-top: 3px; padding: 0 2px;
  display: flex; align-items: center; gap: 3px;
  transition: color 0.3s;
}
.acm-status svg  { width: 13px; height: 13px; }
.acm-status.seen { color: #22c55e; }
.acm-status.read { color: #60a5fa; }

/* ── Body scroll lock (mobile only — desktop widget floats over page) ─────── */
html.cw-scroll-locked { overflow: hidden; }
@media (min-width: 481px) { html.cw-scroll-locked { overflow: auto; } }

/* ── Message history loading dots ─────────────────────────────────────────── */
.cw-msg-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 40px 20px; flex-shrink: 0;
}
.cw-msg-loading div {
  width: 8px; height: 8px; border-radius: 50%;
  background: #d1d5db;
  animation: cw-pulse 1s ease-in-out infinite;
}
.cw-msg-loading div:nth-child(2) { animation-delay: 0.2s; }
.cw-msg-loading div:nth-child(3) { animation-delay: 0.4s; }
@keyframes cw-pulse {
  0%,100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1.1); }
}

/* ── Failed-to-send state ─────────────────────────────────────────────────── */
.cw-msg--failed .cw-bubble { opacity: 0.5; outline: 1.5px dashed #ef4444; cursor: help; }

/* ── Closed conversation banner (pinned at top of thread) ─────────────────── */
.cw-closed-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #f0fdf4 0%, #f9fafb 100%);
  border-bottom: 1px solid #d1fae5;
  flex-shrink: 0;
}
.cw-closed-banner svg {
  width: 20px; height: 20px; color: #16a34a; flex-shrink: 0;
}
.cw-cb-info strong {
  display: block; font-size: 12px; font-weight: 700; color: #166534;
  line-height: 1.3;
}
.cw-cb-info time {
  font-size: 11px; color: #6b7280;
}

/* ── End-of-conversation divider ──────────────────────────────────────────── */
.cw-closed-marker {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 6px;
  font-size: 11px; color: #d1d5db; flex-shrink: 0;
  pointer-events: none;
}
.cw-closed-marker::before,
.cw-closed-marker::after {
  content: ''; flex: 1; height: 1px; background: #f0f0f0;
}

/* ── Closed conversation footer (pinned at bottom) ────────────────────────── */
.cw-closed-footer {
  flex-shrink: 0;
  padding: 14px 16px 16px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
  text-align: center;
}
.cw-cf-msg {
  font-size: 12px; color: #9ca3af; margin: 0 0 10px;
}
.cw-new-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 11px 20px;
  background: #1b1d1f; color: #fff;
  border: none; border-radius: 10px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.cw-new-btn:hover  { background: #2d3139; }
.cw-new-btn:active { transform: scale(0.98); }
.cw-new-btn svg    { width: 16px; height: 16px; pointer-events: none; }

/* ── Input bar ────────────────────────────────────────────────────────────── */
.cw-inputbar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #f0f0f0;
  background: #fff; flex-shrink: 0;
}
.cw-msg-input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid #e5e7eb; border-radius: 10px;
  font-size: 14px; font-family: inherit; color: #111;
  resize: none; line-height: 1.5;
  min-height: 40px; max-height: 110px; overflow-y: auto;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.cw-msg-input:focus {
  outline: none; border-color: #1b1d1f;
  box-shadow: 0 0 0 3px rgba(27,29,31,0.06);
}
.cw-send-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  background: #1b1d1f; color: #fff;
  border: none; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.cw-send-btn:hover  { background: #2d3139; }
.cw-send-btn:active { transform: scale(0.94); }
.cw-send-btn svg    { width: 18px; height: 18px; pointer-events: none; }

/* ── Mobile overrides ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .cw {
    bottom: max(16px, env(safe-area-inset-bottom)); right: 16px;
  }
  .cw-panel {
    /* Full-width card on small screens */
    width: calc(100vw - 32px);
    max-height: calc(100dvh - 96px);
    bottom: max(76px, calc(68px + env(safe-area-inset-bottom)));
    right: 0;
  }
  .cw-input,
  .cw-textarea,
  .cw-msg-input {
    font-size: 16px;
  }
  .cw-fab { width: 54px; height: 54px; }
}


/* ╔═══════════════════════════════════════════════════════════════════════════
   ║  (2)  ADMIN CHAT DASHBOARD
   ╚═══════════════════════════════════════════════════════════════════════════ */

.ac-wrap {
  display: grid;
  grid-template-columns: 320px 1fr 240px;
  height: calc(100vh - 64px);
  overflow: hidden;
  background: #f8f9fa;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.ac-sidebar {
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.ac-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: #e5e7eb;
  border-bottom: 1px solid #e5e7eb; flex-shrink: 0;
}
.ac-stat {
  background: #fff; padding: 12px 8px;
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
}
.ac-stat-n       { font-size: 22px; font-weight: 800; color: #111; font-variant-numeric: tabular-nums; }
.ac-stat-pending { color: #f59e0b; }
.ac-stat-active  { color: #22c55e; }
.ac-stat-agents  { color: #3b82f6; }
.ac-stat-l       { font-size: 10px; color: #9ca3af; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.ac-tabs {
  display: flex; padding: 10px 12px 0;
  gap: 4px; flex-shrink: 0; border-bottom: 1px solid #f3f4f6;
  overflow-x: auto;
}
.ac-tab {
  padding: 6px 12px; border-radius: 20px; border: none;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: transparent; color: #6b7280;
  transition: background 0.12s, color 0.12s; white-space: nowrap;
}
.ac-tab:hover  { background: #f3f4f6; color: #111; }
.ac-tab.active { background: #1b1d1f; color: #fff; }

.ac-search-wrap {
  position: relative; padding: 10px 12px; flex-shrink: 0;
}
.ac-search-icon {
  position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: #9ca3af; pointer-events: none;
}
.ac-search {
  width: 100%; box-sizing: border-box;
  background: #f9fafb; border: 1.5px solid #e5e7eb; border-radius: 8px;
  padding: 8px 12px 8px 34px; font-size: 13px; color: #111;
  font-family: inherit;
}
.ac-search:focus { outline: none; border-color: #1b1d1f; background: #fff; }

.ac-conv-list  { flex: 1; overflow-y: auto; }
.ac-empty-list { padding: 40px 16px; text-align: center; color: #9ca3af; }
.ac-empty-list svg { width: 40px; height: 40px; margin: 0 auto 10px; display: block; }
.ac-empty-list p   { margin: 0; font-size: 13px; }

.ac-conv-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.12s; position: relative;
}
.ac-conv-item:hover  { background: #f9fafb; }
.ac-conv-item.active { background: #f0f9ff; border-left: 3px solid #3b82f6; }
.ac-conv-item--new   { animation: conv-flash 0.6s ease 3; background: #fefce8; }
@keyframes conv-flash { 0%,100% { background: #fefce8; } 50% { background: #fff; } }

.ac-conv-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #1b1d1f; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.ac-conv-info    { flex: 1; min-width: 0; }
.ac-conv-header  { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.ac-conv-name    { font-size: 13px; font-weight: 700; color: #111; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 140px; }
.ac-conv-time    { font-size: 11px; color: #9ca3af; flex-shrink: 0; }
.ac-conv-preview { font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ac-conv-meta    { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.ac-conv-agent   { font-size: 11px; color: #6366f1; font-weight: 600; }

.ac-unread-dot {
  min-width: 20px; height: 20px; padding: 0 5px;
  background: #ef4444; color: #fff;
  border-radius: 10px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; align-self: center;
}

/* Status badges */
.ac-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: capitalize; }
.ac-badge--pending    { background: #fef3c7; color: #92400e; }
.ac-badge--active     { background: #d1fae5; color: #065f46; }
.ac-badge--closed     { background: #f3f4f6; color: #4b5563; }
.ac-badge--spam       { background: #fee2e2; color: #991b1b; }
.ac-badge--processing { background: #dbeafe; color: #1e40af; }
.ac-badge--shipped    { background: #d1fae5; color: #065f46; }
.ac-badge--completed  { background: #d1fae5; color: #065f46; }
.ac-badge--cancelled  { background: #fee2e2; color: #991b1b; }

/* ── Main panel ──────────────────────────────────────────────────────────── */
.ac-main { display: flex; flex-direction: column; overflow: hidden; background: #f8f9fa; }

.ac-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px; color: #9ca3af;
}
.ac-empty-state svg { width: 56px; height: 56px; margin-bottom: 16px; opacity: 0.5; }
.ac-empty-state h3  { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: #374151; }
.ac-empty-state p   { margin: 0; font-size: 13px; }

.ac-thread { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.ac-thread-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: #fff;
  border-bottom: 1px solid #e5e7eb; flex-shrink: 0;
}
.ac-visitor-info   { display: flex; align-items: center; gap: 12px; }
.ac-visitor-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #1b1d1f; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.ac-visitor-name  { font-size: 15px; font-weight: 700; color: #111; }
.ac-visitor-email { font-size: 12px; color: #6b7280; margin-top: 1px; }
.ac-thread-actions{ display: flex; gap: 6px; }

.ac-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px; border: 1.5px solid #e5e7eb;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: #fff; color: #374151; transition: all 0.12s;
}
.ac-action-btn svg           { width: 15px; height: 15px; }
.ac-action-btn:hover         { background: #f9fafb; }
.ac-action-btn--close        { border-color: #d1fae5; color: #065f46; }
.ac-action-btn--close:hover  { background: #d1fae5; }
.ac-action-btn--block        { border-color: #fee2e2; color: #991b1b; }
.ac-action-btn--block:hover  { background: #fee2e2; }
.ac-action-btn--assign       { border-color: #dbeafe; color: #1e40af; }
.ac-action-btn--assign:hover { background: #dbeafe; }

.ac-thread-body   { flex: 1; display: flex; overflow: hidden; }
.ac-messages-wrap { flex: 1; overflow-y: auto; }
.ac-messages      { padding: 16px; display: flex; flex-direction: column; gap: 6px; min-height: 100%; }

.acm-row           { display: flex; }
.acm-row--visitor  { justify-content: flex-end; }
.acm-row--agent    { justify-content: flex-start; }
.acm-row--system   { justify-content: center; padding: 4px 0; }
.acm-bubble-wrap   { display: flex; flex-direction: column; max-width: 75%; }
.acm-row--visitor .acm-bubble-wrap { align-items: flex-end; }
.acm-row--agent   .acm-bubble-wrap { align-items: flex-start; }
.acm-sender { font-size: 11px; font-weight: 600; color: #9ca3af; margin-bottom: 3px; padding: 0 2px; }
.acm-bubble {
  padding: 9px 13px; border-radius: 16px;
  font-size: 14px; line-height: 1.5; word-break: break-word; white-space: pre-wrap;
}
.acm-bubble--visitor { background: #1b1d1f; color: #fff; border-bottom-right-radius: 4px; }
.acm-bubble--agent   { background: #fff; color: #111; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.acm-system  { background: #f0f9ff; color: #0369a1; font-size: 12px; border-radius: 20px; padding: 5px 14px; text-align: center; }
.acm-time    { font-size: 10px; color: #d1d5db; margin-top: 3px; padding: 0 2px; }
.ac-load-error { color: #dc2626; font-size: 13px; padding: 16px; text-align: center; }

.ac-context {
  width: 220px; flex-shrink: 0; border-left: 1px solid #e5e7eb;
  background: #fff; overflow-y: auto;
}
.ac-context-section { padding: 14px; border-bottom: 1px solid #f3f4f6; }
.ac-context-title   { font-size: 11px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.ac-context-dl      { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.ac-dl-dt           { font-size: 11px; font-weight: 600; color: #6b7280; white-space: nowrap; padding: 2px 0; }
.ac-dl-dd           { font-size: 12px; color: #111; margin: 0; word-break: break-all; padding: 2px 0; }
.ac-link            { color: #3b82f6; text-decoration: none; }
.ac-link:hover      { text-decoration: underline; }
.ac-context-empty   { font-size: 12px; color: #9ca3af; margin: 0; }
.ac-loading         { font-size: 12px; color: #9ca3af; margin: 0; font-style: italic; }

.ac-order-card   { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; margin-bottom: 8px; font-size: 12px; }
.ac-order-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.ac-order-num    { font-weight: 700; color: #1b1d1f; text-decoration: none; }
.ac-order-num:hover { text-decoration: underline; }
.ac-order-meta   { color: #6b7280; font-size: 11px; margin-bottom: 6px; }
.ac-order-items  { list-style: none; margin: 0; padding: 0; }
.ac-order-items li { color: #374151; padding: 2px 0; border-top: 1px solid #f3f4f6; }
.ac-variant      { color: #9ca3af; }

.ac-reply-bar {
  background: #fff; border-top: 1px solid #e5e7eb;
  padding: 12px 14px; flex-shrink: 0;
}
.ac-reply-input {
  width: 100%; box-sizing: border-box;
  border: 1.5px solid #e5e7eb; border-radius: 10px;
  padding: 10px 14px; font-size: 14px; font-family: inherit;
  resize: none; max-height: 160px; line-height: 1.5;
  transition: border-color 0.15s; display: block;
}
.ac-reply-input:focus { outline: none; border-color: #1b1d1f; box-shadow: 0 0 0 3px rgba(27,29,31,0.07); }
.ac-reply-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.ac-reply-char { font-size: 11px; color: #d1d5db; }
.ac-reply-send {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; background: #1b1d1f; color: #fff;
  border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.12s;
}
.ac-reply-send:hover    { background: #2d3139; }
.ac-reply-send:disabled { opacity: 0.45; cursor: default; }
.ac-reply-send svg      { width: 16px; height: 16px; }

.ac-right-panel {
  background: #fff; border-left: 1px solid #e5e7eb;
  overflow-y: auto;
}
.ac-rp-section { padding: 16px; border-bottom: 1px solid #f3f4f6; }
.ac-rp-title   { font-size: 11px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }

.ac-agent-row  { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.ac-agent-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ac-agent-dot.online  { background: #22c55e; }
.ac-agent-dot.offline { background: #d1d5db; }
.ac-agent-name { flex: 1; font-weight: 600; color: #111; }
.ac-agent-role { font-size: 11px; color: #9ca3af; }

.ac-rp-stat-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: #6b7280; margin-bottom: 8px; }
.ac-rp-stat-row strong { color: #111; font-size: 13px; font-variant-numeric: tabular-nums; }

.ac-blocked-ip-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px; padding: 8px;
  background: #fef2f2; border-radius: 8px;
}
.ac-ip        { font-size: 12px; font-family: monospace; color: #991b1b; }
.ac-ip-reason { font-size: 11px; color: #9ca3af; display: block; margin-top: 2px; }
.ac-unblock-btn {
  background: none; border: 1px solid #fca5a5; border-radius: 6px;
  padding: 4px; cursor: pointer; color: #dc2626; flex-shrink: 0;
  display: flex; align-items: center;
}
.ac-unblock-btn:hover { background: #fee2e2; }
.ac-unblock-btn svg   { width: 14px; height: 14px; }
