/* Chilview Live — Support-page chat widget + desk */
.cv-live-panel {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 80;
  width: min(24.5rem, calc(100vw - 1.5rem));
  max-height: min(34rem, calc(100vh - 5.5rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(241, 196, 15, 0.28);
  border-radius: 1.15rem;
  background: rgba(10, 12, 18, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  color: #e8eaf0;
}

.cv-live-panel[hidden],
.cv-live-log[hidden],
.cv-live-start[hidden],
.cv-live-row[hidden] {
  display: none !important;
}

.cv-live-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(241, 196, 15, 0.12), transparent);
}

.cv-live-panel__head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.cv-live-panel__head p {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: #b7becd;
}

.cv-live-close {
  border: 0;
  background: transparent;
  color: #cfd5e2;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.cv-live-body {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.9rem 1rem 1rem;
  min-height: 0;
  flex: 1;
}

.cv-live-start {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cv-live-start .cv-live-send {
  width: 100%;
}

.cv-live-log {
  flex: 1;
  min-height: 10rem;
  max-height: 16rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cv-live-bubble {
  max-width: 88%;
  padding: 0.55rem 0.7rem;
  border-radius: 0.8rem;
  font-size: 0.86rem;
  line-height: 1.4;
  font-family: inherit, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
}

.cv-live-bubble--visitor {
  align-self: flex-end;
  background: #f1c40f;
  color: #111;
}

.cv-live-bubble--agent {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
}

.cv-live-bubble--system {
  align-self: center;
  background: transparent;
  color: #9aa3b5;
  font-size: 0.75rem;
}

.cv-live-field {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.7rem;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
}

.cv-live-field:focus {
  outline: 2px solid rgba(241, 196, 15, 0.45);
}

.cv-live-send {
  border: 0;
  border-radius: 0.7rem;
  background: #f1c40f;
  color: #111;
  font-weight: 800;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

.cv-live-fieldwrap {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.cv-live-field-error {
  margin: 0;
  min-height: 1em;
  font-size: 0.75rem;
  font-weight: 650;
  color: #f5a8a8;
}

.cv-live-field-error[hidden] {
  display: none !important;
}

.cv-live-send:disabled {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(232, 234, 240, 0.4);
  cursor: not-allowed;
  box-shadow: none;
}

.cv-live-row {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
}

.cv-live-composer {
  position: relative;
  flex: 1;
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 0;
}

.cv-live-composer--stack {
  flex-direction: column;
  align-items: stretch;
}

.cv-live-composer--stack .cv-live-field {
  width: 100%;
  resize: none;
  padding-bottom: 2.35rem;
}

.cv-live-composer--stack .cv-live-emoji-btn {
  position: absolute;
  left: 0.3rem;
  bottom: 0.3rem;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  min-height: 2rem;
  border: 0;
  background: transparent;
}

.cv-live-emoji-btn {
  flex: 0 0 auto;
  width: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.7rem;
  background: rgba(0, 0, 0, 0.35);
  color: #cfd5e2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.cv-live-emoji-btn[aria-expanded="true"],
.cv-live-emoji-btn:hover {
  color: #f1c40f;
  border-color: rgba(241, 196, 15, 0.45);
}

.cv-live-emoji-pop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 0.35rem);
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.12rem;
  padding: 0.45rem;
  max-height: 10.5rem;
  overflow: auto;
  border: 1px solid rgba(241, 196, 15, 0.28);
  border-radius: 0.8rem;
  background: rgba(12, 14, 22, 0.98);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.cv-live-emoji-pop[hidden] {
  display: none !important;
}

.cv-live-emoji-choice {
  border: 0;
  background: transparent;
  border-radius: 0.45rem;
  font-size: 1.2rem;
  line-height: 1.35;
  cursor: pointer;
  padding: 0.15rem 0;
}

.cv-live-emoji-choice:hover {
  background: rgba(241, 196, 15, 0.16);
}

.cv-live-status {
  min-height: 1.1rem;
  font-size: 0.75rem;
  color: #9ee6c3;
}

.cv-live-status[data-state="error"] {
  color: #f5a8a8;
}

.cv-live-field[aria-invalid="true"] {
  border-color: rgba(245, 168, 168, 0.7);
  outline: 2px solid rgba(245, 168, 168, 0.35);
}

.cv-live-desk {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.cv-live-desk .cv-live-panel {
  position: static;
  width: 100%;
  max-height: none;
}

@media (max-width: 767px) {
  .cv-live-panel {
    right: 0.65rem;
    bottom: 0.65rem;
    width: calc(100vw - 1.3rem);
    max-height: min(78vh, 34rem);
  }

  .cv-live-panel__head h2 {
    font-size: 1.05rem;
  }

  .cv-live-panel__head p {
    font-size: 0.85rem;
    color: #c5ccd9;
  }

  .cv-live-field,
  .cv-live-send,
  .cv-live-row .cv-live-emoji-btn {
    min-height: 2.85rem;
    font-size: 1rem;
  }

  .cv-live-send {
    min-width: 4.5rem;
  }

  .cv-live-status {
    font-size: 0.85rem;
  }
}
