/* Admin Live Chat — messaging desk (aligned with WhatsApp inbox)
   Brand: Crimson Wave navy / crimson */

#ams-live-chat-panel.ams-lc-root {
  --lc-crimson: var(--ams-primary, #AE2129);
  --lc-navy: var(--ams-secondary, #161C34);
  /* Theme-invariant brand navy for surfaces that must stay a solid deep
     color regardless of theme (avatars, agent bubbles, solid navy buttons) —
     --lc-navy itself flips to a light ink color in dark mode below, so those
     spots use this instead of --lc-navy directly. */
  --lc-navy-solid: #161C34;
  --lc-muted: #5b6575;
  --lc-line: #e3e5ea;
  --lc-soft: #f5f6f8;
  --lc-canvas: #f5f5f3;
  --lc-in: #ffffff;
  --lc-out: #f4e8e9;
  --lc-white: #fff;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  color: var(--lc-navy);
  font-family: Manrope, Inter, "IBM Plex Sans", Tahoma, system-ui, sans-serif;
}

/* —— Dark mode —— */
html.dark #ams-live-chat-panel.ams-lc-root {
  --lc-navy: #EEF1F8;
  --lc-muted: #9AA3BE;
  --lc-line: #2E3A5C;
  --lc-soft: #202946;
  --lc-canvas: #161C34;
  --lc-in: #202946;
  --lc-out: #3A2226;
  --lc-white: #202946;
}
html.dark #ams-live-chat-panel .ams-lc-sidebar { background: #F7F8FA; }
html.dark #ams-live-chat-panel .ams-lc-item:hover,
html.dark #ams-live-chat-panel .ams-lc-item.is-active { background: #fff; }
html.dark #ams-live-chat-panel .ams-lc-desk { background: #1A2140; }
html.dark #ams-live-chat-panel .ams-lc-thread-head {
  background: linear-gradient(180deg, #202946 0%, #1c2440 100%);
}
html.dark #ams-live-chat-panel .ams-lc-badge.open,
html.dark #ams-live-chat-panel .ams-lc-badge.assigned,
html.dark #ams-live-chat-panel .ams-lc-badge.queued { background: #1B2A47; border-color: #2E4A78; color: #9FC3F0; }
html.dark #ams-live-chat-panel .ams-lc-badge.collecting { background: #3A2E12; border-color: #6B5423; color: #F0C97D; }
html.dark #ams-live-chat-panel .ams-lc-channel.wa { background: #123822; border-color: #1F5C3A; color: #7FD9A4; }
html.dark #ams-live-chat-panel .ams-lc-channel.live { background: #1B2347; border-color: #2E3A6E; color: #A8B6F0; }
html.dark #ams-lc-slot.ams-lc-slot-fallback { background: #10162B; }
html.dark #ams-live-chat-panel .ams-lc-modal-card { background: #202946; color: #EEF1F8; }
html.dark #ams-live-chat-panel .ams-lc-modal-card > p,
html.dark #ams-live-chat-panel .ams-lc-modal-card label { color: #9AA3BE; }
html.dark #ams-live-chat-panel .ams-lc-modal-close { color: #9AA3BE; }
html.dark #ams-live-chat-panel .ams-lc-modal-close:hover { background: #293555; color: #EEF1F8; }
html.dark #ams-live-chat-panel .ams-lc-modal-section { border-color: #2E3A5C; }
html.dark #ams-live-chat-panel .ams-lc-field-hint { color: #9AA3BE; }
html.dark #ams-live-chat-panel .ams-lc-modal-divider { color: #9AA3BE; }
html.dark #ams-live-chat-panel .ams-lc-modal-divider::before,
html.dark #ams-live-chat-panel .ams-lc-modal-divider::after { background: #2E3A5C; }
html.dark #ams-live-chat-panel .ams-lc-thread {
  background:
    linear-gradient(180deg, rgba(22, 28, 52, 0.97), rgba(22, 28, 52, 0.97)),
    repeating-linear-gradient(-12deg, transparent, transparent 11px, rgba(255, 255, 255, 0.02) 11px, rgba(255, 255, 255, 0.02) 12px);
}

#ams-live-chat-panel.ams-lc-root *,
#ams-live-chat-panel.ams-lc-root *::before,
#ams-live-chat-panel.ams-lc-root *::after {
  box-sizing: border-box;
}

/* —— Hero —— */
.ams-lc-hero {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--lc-navy);
}

.ams-lc-eyebrow {
  margin: 0 0 2px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lc-crimson);
}

.ams-lc-hero h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--lc-navy);
}

.ams-lc-hero p {
  margin: 2px 0 0;
  color: var(--lc-muted);
  font-size: 12.5px;
  max-width: 52ch;
  line-height: 1.4;
}

.ams-lc-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.ams-lc-hero-link,
.ams-lc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--lc-line);
  border-radius: 8px;
  background: var(--lc-white);
  color: var(--lc-navy);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.ams-lc-hero-link:hover,
.ams-lc-btn:hover { filter: brightness(0.98); border-color: var(--lc-crimson); }

.ams-lc-btn.navy,
.ams-lc-hero-link.navy {
  background: var(--lc-navy-solid);
  border-color: var(--lc-navy-solid);
  color: #fff;
}

.ams-lc-btn.accent {
  background: var(--lc-crimson);
  border-color: var(--lc-crimson);
  color: #fff;
}

.ams-lc-btn.ghost {
  background: var(--lc-white);
  color: var(--lc-navy);
  border-color: var(--lc-line);
}

.ams-lc-btn.soft {
  background: var(--lc-soft);
  border-color: var(--lc-line);
  color: var(--lc-navy);
}

/* —— Toolbar —— */
.ams-lc-toolbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(120px, 0.8fr) minmax(140px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.ams-lc-toolbar input,
.ams-lc-toolbar select,
.ams-lc-field,
.ams-lc-compose textarea,
.ams-lc-compose input[type="text"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--lc-line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--lc-white);
  color: var(--lc-navy);
  font: inherit;
  font-size: 13px;
}

.ams-lc-toolbar input:focus,
.ams-lc-toolbar select:focus,
.ams-lc-compose textarea:focus,
.ams-lc-compose input[type="text"]:focus,
.ams-lc-field:focus {
  outline: none;
  border-color: var(--lc-crimson);
  box-shadow: 0 0 0 3px rgba(174, 33, 41, 0.12);
}

/* —— Shell —— */
.ams-lc-shell {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(240px, 280px);
  gap: 0;
  min-height: 420px;
  max-height: 100%;
  border: 1px solid var(--lc-line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--lc-white);
  box-shadow: 0 10px 32px rgba(22, 28, 52, 0.08);
  margin-inline-start: 0;
}

.ams-lc-sidebar {
  display: flex;
  flex-direction: column;
  border-inline-end: 1px solid var(--lc-line);
  background: #f7f8fa;
  box-shadow: inset 3px 0 0 var(--lc-navy);
  min-height: 0;
  position: relative;
  z-index: 2;
}

.ams-lc-sidebar-label {
  padding: 12px 14px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--lc-muted);
  border-bottom: 1px solid var(--lc-line);
  background: var(--lc-white);
}

.ams-lc-list {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.ams-lc-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 2px 10px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--lc-line);
  background: transparent;
  text-align: start;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.ams-lc-item:hover { background: #fff; }

.ams-lc-item.is-active {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--lc-crimson);
}

html.ams-ar .ams-lc-item.is-active,
html[dir="rtl"] .ams-lc-item.is-active {
  box-shadow: inset -3px 0 0 var(--lc-crimson);
}

.ams-lc-avatar {
  grid-row: 1 / span 3;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--lc-navy-solid);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  align-self: start;
}

.ams-lc-item-ticket {
  grid-column: 2;
  font-size: 11px;
  font-weight: 800;
  color: var(--lc-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.ams-lc-item-name {
  grid-column: 2;
  font-size: 13px;
  font-weight: 700;
  color: var(--lc-navy);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ams-lc-item-meta {
  grid-column: 2 / -1;
  font-size: 12px;
  color: var(--lc-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ams-lc-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--lc-soft);
  color: var(--lc-navy);
  border: 1px solid var(--lc-line);
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: start;
}

.ams-lc-badge.open,
.ams-lc-badge.assigned,
.ams-lc-badge.queued { background: #eef6ff; border-color: #c9ddf5; color: #1e3a5f; }
.ams-lc-badge.closed { background: var(--lc-soft); color: var(--lc-muted); }
.ams-lc-badge.collecting { background: #fff6e8; border-color: #f0d7a8; color: #7a4e00; }

.ams-lc-empty,
.ams-lc-placeholder {
  padding: 28px 18px;
  text-align: center;
  color: var(--lc-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* —— Thread —— */
.ams-lc-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--lc-white);
}

.ams-lc-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--lc-line);
  background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
  min-height: 68px;
}

.ams-lc-thread-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--lc-navy);
}

.ams-lc-thread-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--lc-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ams-lc-thread {
  flex: 1;
  overflow: auto;
  min-height: 280px;
  max-height: none;
  padding: 18px 16px;
  background:
    linear-gradient(180deg, rgba(245, 245, 243, 0.95), rgba(245, 245, 243, 0.95)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 11px,
      rgba(22, 28, 52, 0.015) 11px,
      rgba(22, 28, 52, 0.015) 12px
    );
}

.ams-lc-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(78%, 520px);
  margin: 0 0 12px;
}

.ams-lc-msg.is-agent {
  align-items: flex-end;
  margin-inline-start: auto;
}

.ams-lc-item.needs-assign .ams-lc-item-meta { color: var(--lc-crimson); font-weight: 700; }

.ams-lc-bubble {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--lc-line);
  background: var(--lc-white);
  line-height: 1.45;
  font-size: 13px;
  color: var(--lc-navy);
  box-shadow: 0 1px 2px rgba(22, 28, 52, 0.06);
  border-bottom-left-radius: 4px;
}

.ams-lc-msg.is-agent .ams-lc-bubble {
  background: var(--lc-navy-solid);
  border-color: var(--lc-navy-solid);
  color: #fff;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}

html.ams-ar .ams-lc-msg.is-agent .ams-lc-bubble,
html[dir="rtl"] .ams-lc-msg.is-agent .ams-lc-bubble {
  border-bottom-right-radius: 14px;
  border-bottom-left-radius: 4px;
}

html.ams-ar .ams-lc-msg:not(.is-agent) .ams-lc-bubble,
html[dir="rtl"] .ams-lc-msg:not(.is-agent) .ams-lc-bubble {
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}

.ams-lc-msg-who {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--lc-crimson);
  opacity: 0.9;
}

.ams-lc-msg.is-agent .ams-lc-msg-who {
  color: #f3c9cc;
  opacity: 1;
}

.ams-lc-msg-time {
  margin-top: 4px;
  font-size: 10px;
  color: var(--lc-muted);
  padding: 0 4px;
}

.ams-lc-msg.is-agent .ams-lc-msg-time { text-align: end; }

.ams-lc-msg a {
  color: var(--lc-crimson);
  font-weight: 700;
  text-decoration: underline;
}

.ams-lc-msg.is-agent a { color: #fff; }

.ams-lc-media { margin-top: 8px; }
.ams-lc-media img,
.ams-lc-media video {
  display: block;
  max-width: min(280px, 100%);
  max-height: 240px;
  border-radius: 10px;
}
.ams-lc-media audio { width: min(260px, 100%); }
.ams-lc-chip {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(22, 28, 52, 0.06);
  font-size: 12px;
  font-weight: 700;
}
.ams-lc-msg.is-agent .ams-lc-chip { background: rgba(255,255,255,0.12); }

.ams-lc-desk {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fafbfc;
  border-inline-start: 1px solid var(--lc-line);
}
.ams-lc-desk-body {
  padding: 14px;
  overflow: auto;
}
.ams-lc-desk-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--lc-muted);
  line-height: 1.45;
}
.ams-lc-desk .ams-lc-actions {
  flex-direction: column;
  align-items: stretch;
}
.ams-lc-desk .ams-lc-field {
  max-width: none;
  width: 100%;
}
.ams-lc-desk .ams-lc-helpers {
  flex-direction: column;
}
.ams-lc-desk .ams-lc-btn { width: 100%; }

/* —— Message bubble actions (star, edit, delete, tombstone) —— */
.ams-lc-bubble { position: relative; }
.ams-lc-msg.deleted .ams-lc-bubble {
  background: transparent;
  border: 1px dashed var(--lc-line);
  box-shadow: none;
  color: var(--lc-navy);
}
.ams-lc-deleted-note { font-style: italic; opacity: 0.75; font-size: 12.5px; }
.ams-lc-star-mark { color: #d9a319; }
.ams-lc-msg.is-agent .ams-lc-star-mark { color: #f0d27a; }
#ams-live-chat-panel.ams-lc-root .ams-lc-msg-menu-btn {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  border: 0;
  background: transparent;
  color: var(--lc-muted);
  min-height: 22px;
  height: 22px;
  width: 22px;
  padding: 0;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, background-color 120ms ease;
}
.ams-lc-msg.is-agent .ams-lc-msg-menu-btn { color: rgba(255, 255, 255, 0.85); }
.ams-lc-bubble:hover .ams-lc-msg-menu-btn,
#ams-live-chat-panel.ams-lc-root .ams-lc-msg-menu-btn:focus-visible { opacity: 1; }
#ams-live-chat-panel.ams-lc-root .ams-lc-msg-menu-btn:hover { background: rgba(127, 133, 153, 0.22); }
.ams-lc-msg.is-agent .ams-lc-msg-menu-btn:hover { background: rgba(255, 255, 255, 0.2); }
.ams-lc-msg-body { padding-inline-end: 20px; }

.ams-lc-menu {
  position: fixed;
  z-index: 80;
  min-width: 140px;
  background: var(--lc-white);
  border: 1px solid var(--lc-line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(22, 28, 52, 0.18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#ams-live-chat-panel.ams-lc-root .ams-lc-menu-item {
  border: 0;
  background: transparent;
  color: var(--lc-navy);
  text-align: start;
  padding: 8px 10px;
  min-height: auto;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.ams-lc-menu-item:hover { background: var(--lc-soft); }
.ams-lc-menu-item.danger { color: var(--lc-crimson); }

.ams-lc-edit-box {
  width: 100%;
  min-height: 60px;
  border: 1px solid var(--lc-line);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--lc-navy);
  background: var(--lc-white);
  resize: vertical;
}
.ams-lc-edit-actions { display: flex; gap: 6px; margin-top: 6px; }
.ams-lc-edit-actions .ams-lc-btn { width: auto; flex: 1 1 auto; }
.ams-lc-btn.small { min-height: 28px; padding: 4px 10px; font-size: 11px; }

/* —— Tags —— */
.ams-lc-tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ams-lc-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--lc-line);
  border-radius: 999px;
  padding: 3px 6px 3px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--lc-navy);
  background: var(--lc-soft);
}
#ams-live-chat-panel.ams-lc-root .ams-lc-tag-remove {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px;
  min-height: auto;
}
.ams-lc-item-tag {
  display: inline-block;
  border: 1px solid var(--lc-line);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  margin-inline-start: 4px;
  background: var(--lc-soft);
}

/* —— Notes —— */
.ams-lc-notes-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.ams-lc-note-item {
  border: 1px solid var(--lc-line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--lc-soft);
}
.ams-lc-note-body { font-size: 12.5px; color: var(--lc-navy); white-space: pre-wrap; }
.ams-lc-note-meta { font-size: 10.5px; color: var(--lc-muted); margin-top: 4px; }
.ams-lc-note-form { display: flex; flex-direction: column; gap: 6px; }
.ams-lc-note-form textarea {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--lc-line);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--lc-navy);
  background: var(--lc-white);
  resize: vertical;
}
.ams-lc-note-form .ams-lc-btn { align-self: flex-end; width: auto; }

.ams-lc-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  background: var(--lc-navy-solid);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  max-width: min(360px, 90vw);
  box-shadow: 0 12px 28px rgba(22, 28, 52, 0.2);
}
.ams-lc-toast.err { background: var(--lc-crimson); }

.ams-lc-main .ams-lc-compose {
  border-top: 1px solid var(--lc-line);
  padding: 12px;
  background: var(--lc-white);
}

#ams-lc-slot.ams-lc-slot-fallback {
  position: fixed !important;
  /* top/left are set inline by ensureLcSlot()/positionOverlaySlot() in
     ams-enhancements.js, measured from the real header/sidebar so this stays
     correct instead of drifting from a guessed 4rem/18rem. These are just
     first-paint fallbacks for the instant before that JS runs. */
  top: 4rem;
  left: 18rem;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 20 !important;
  overflow: auto;
  background: #f5f5f3;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
}
@media (max-width: 1023px) {
  #ams-lc-slot.ams-lc-slot-fallback {
    padding: 12px;
  }
}

body.ams-live-chat-page [data-ams-hidden-page="live-chat"] {
  display: none !important;
}

/* —— Controls —— */
.ams-lc-controls {
  border-top: 1px solid var(--lc-line);
  background: var(--lc-white);
  padding: 12px 14px 14px;
}

.ams-lc-controls[hidden] { display: none !important; }

.ams-lc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.ams-lc-actions .ams-lc-field {
  min-width: 160px;
  flex: 1 1 180px;
  max-width: 260px;
}

.ams-lc-helpers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.ams-lc-compose {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.ams-lc-compose label.ams-lc-btn {
  margin: 0;
  cursor: pointer;
  align-self: end;
}

.ams-lc-compose input[type="file"] { display: none; }

.ams-lc-compose textarea {
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  line-height: 1.4;
}

/* —— Overrides vs global workspace form CSS —— */
#ams-live-chat-panel.ams-lc-root input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#ams-live-chat-panel.ams-lc-root select,
#ams-live-chat-panel.ams-lc-root textarea {
  width: auto;
  max-width: 100%;
}

#ams-live-chat-panel.ams-lc-root .ams-lc-toolbar input,
#ams-live-chat-panel.ams-lc-root .ams-lc-toolbar select,
#ams-live-chat-panel.ams-lc-root .ams-lc-field,
#ams-live-chat-panel.ams-lc-root .ams-lc-compose textarea,
#ams-live-chat-panel.ams-lc-root .ams-lc-compose input[type="text"] {
  width: 100%;
}

#ams-live-chat-panel.ams-lc-root label {
  display: inline-flex;
  margin: 0;
  letter-spacing: normal;
  text-transform: none;
  font-size: 12px;
}

#ams-live-chat-panel.ams-lc-root button,
#ams-live-chat-panel.ams-lc-root .ams-lc-btn,
#ams-live-chat-panel.ams-lc-root .ams-lc-hero-link {
  width: auto;
  display: inline-flex;
}

#ams-live-chat-panel.ams-lc-root .ams-lc-item {
  width: 100%;
  display: grid;
}

#ams-live-chat-panel.ams-lc-root .ams-lc-shell {
  width: 100%;
}

@media (max-width: 900px) {
  .ams-lc-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .ams-lc-toolbar .ams-lc-btn {
    grid-column: 1 / -1;
  }
  .ams-lc-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .ams-lc-sidebar {
    border-inline-end: 0;
    border-bottom: 1px solid var(--lc-line);
    max-height: 260px;
  }
  .ams-lc-desk {
    border-inline-start: 0;
    border-top: 1px solid var(--lc-line);
  }
  .ams-lc-thread { min-height: 320px; }
}

@media (max-width: 560px) {
  .ams-lc-toolbar { grid-template-columns: 1fr; }
  .ams-lc-compose { grid-template-columns: auto 1fr; }
  .ams-lc-compose .ams-lc-btn.accent { grid-column: 1 / -1; }
}

#ams-lc-slot {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 20px;
  box-sizing: border-box;
}
#ams-lc-slot:not(.ams-lc-slot-fallback) {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  height: auto !important;
  z-index: 1 !important;
}

body.ams-live-chat-page [data-ams-hidden-page="live-chat"] {
  display: none !important;
}

html.ams-ar .ams-wa-list-wrap,
html[dir="rtl"] .ams-wa-list-wrap {
  box-shadow: inset -3px 0 0 var(--desk-navy);
}
html.ams-ar .ams-lc-sidebar,
html[dir="rtl"] .ams-lc-sidebar {
  box-shadow: inset -3px 0 0 var(--lc-navy);
}

.ams-lc-channel {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-inline-end: 4px;
}
.ams-lc-channel.wa {
  background: #e8f7ee;
  color: #0f6b3a;
  border: 1px solid #b7dfc2;
}
.ams-lc-channel.live {
  background: #eef2ff;
  color: #1e3a5f;
  border: 1px solid #c9d4f5;
}

.ams-lc-btn.is-recording {
  background: var(--lc-crimson) !important;
  color: #fff !important;
  border-color: var(--lc-crimson) !important;
  animation: ams-lc-pulse 1.2s ease-in-out infinite;
}
@keyframes ams-lc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.ams-lc-hero-link.accent {
  background: var(--lc-crimson);
  color: #fff;
  border-color: var(--lc-crimson);
}

.ams-lc-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(22, 28, 52, 0.45);
  padding: 20px;
}
.ams-lc-modal[hidden] { display: none !important; }
.ams-lc-modal-card {
  position: relative;
  width: min(440px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(22, 28, 52, 0.2);
  color: var(--lc-navy);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.ams-lc-modal-card h2 { margin: 0 0 4px; font-size: 18px; }
.ams-lc-modal-card > p { margin: 0 0 14px; color: var(--lc-muted); font-size: 13px; }
.ams-lc-modal-card label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin: 10px 0 6px;
  color: var(--lc-muted);
}
.ams-lc-modal-card input,
.ams-lc-modal-card textarea {
  width: 100%;
  border: 1px solid var(--lc-line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--lc-navy);
  background: var(--lc-white);
}
.ams-lc-modal-card input:focus,
.ams-lc-modal-card textarea:focus {
  outline: none;
  border-color: var(--lc-crimson);
  box-shadow: 0 0 0 3px rgba(174, 33, 41, 0.12);
}
.ams-lc-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.ams-lc-modal-status {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--lc-muted);
}
.ams-lc-modal-status.is-error { color: var(--lc-crimson); }
.ams-lc-modal-status.is-pending { color: var(--lc-muted); }

/* —— "Message on WhatsApp" modal —— */
.ams-lc-modal-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  width: 28px;
  height: 28px;
  min-height: auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--lc-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ams-lc-modal-close:hover { background: var(--lc-soft); color: var(--lc-navy); }
.ams-lc-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-inline-end: 24px;
}
.ams-lc-modal-wa-icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.ams-lc-req { color: var(--lc-crimson); font-weight: 800; }
.ams-lc-optional { font-weight: 500; text-transform: none; letter-spacing: 0; opacity: 0.8; }
.ams-lc-field-hint {
  margin: -2px 0 0;
  font-size: 11px;
  color: var(--lc-muted);
}
.ams-lc-modal-section {
  border: 1px solid var(--lc-line);
  border-radius: 10px;
  padding: 10px 12px 12px;
  margin-top: 12px;
}
.ams-lc-modal-section label { margin-top: 0; }
.ams-lc-modal-section-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lc-crimson);
}
.ams-lc-modal-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--lc-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.ams-lc-modal-divider::before,
.ams-lc-modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--lc-line);
}
#ams-wa-new-send:disabled { opacity: 0.6; cursor: wait; }

.ams-lc-compose {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
}
@media (max-width: 560px) {
  .ams-lc-compose { grid-template-columns: auto auto 1fr; }
  .ams-lc-compose .ams-lc-btn.accent { grid-column: 1 / -1; }
}

/* Keep compose / actions clickable above any overlay chrome. */
#ams-live-chat-panel,
#ams-live-chat-panel .ams-lc-compose,
#ams-live-chat-panel .ams-lc-actions,
#ams-live-chat-panel .ams-lc-list,
#ams-lc-slot {
  pointer-events: auto;
}
#ams-live-chat-panel .ams-lc-compose .ams-lc-btn.accent[disabled] {
  opacity: 0.65;
  cursor: wait;
}
#ams-live-chat-panel .ams-lc-sidebar,
#ams-live-chat-panel .ams-lc-list {
  background: #F7F8FA !important;
  color: #161C34 !important;
}
#ams-live-chat-panel .ams-lc-sidebar-label {
  background: #fff !important;
  color: #5B6575 !important;
}
#ams-live-chat-panel .ams-lc-item {
  background: #F7F8FA !important;
  color: #161C34 !important;
}
#ams-live-chat-panel .ams-lc-item:hover,
#ams-live-chat-panel .ams-lc-item.is-active {
  background: #fff !important;
}
#ams-live-chat-panel .ams-lc-item-name { color: #161C34 !important; }
#ams-live-chat-panel .ams-lc-item-ticket,
#ams-live-chat-panel .ams-lc-item-meta { color: #5B6575 !important; }
html.dark #ams-live-chat-panel .ams-lc-sidebar,
html.dark #ams-live-chat-panel .ams-lc-list,
html.dark #ams-live-chat-panel .ams-lc-item {
  background: #F7F8FA !important;
  color: #161C34 !important;
}
html.dark #ams-live-chat-panel .ams-lc-item:hover,
html.dark #ams-live-chat-panel .ams-lc-item.is-active { background: #fff !important; }
html.dark #ams-live-chat-panel .ams-lc-item-name { color: #161C34 !important; }
html.dark #ams-live-chat-panel .ams-lc-item-ticket,
html.dark #ams-live-chat-panel .ams-lc-item-meta,
html.dark #ams-live-chat-panel .ams-lc-sidebar-label { color: #5B6575 !important; }

/* Keep compose / actions clickable above any overlay chrome. */
#ams-live-chat-panel,
#ams-live-chat-panel .ams-lc-compose,
#ams-live-chat-panel .ams-lc-actions,
#ams-live-chat-panel .ams-lc-list,
#ams-lc-slot {
  pointer-events: auto;
}
#ams-live-chat-panel .ams-lc-compose .ams-lc-btn.accent[disabled] {
  opacity: 0.65;
  cursor: wait;
}
