/* AVC-AI in-app customer assistant — floating side banner (app pages only) */
.avc-assist-tab {
  position: fixed;
  right: 0;
  top: 42%;
  transform: translateY(-50%);
  z-index: 9500;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 14px 8px;
  border: 1px solid rgba(160, 200, 255, 0.35);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background: rgba(12, 18, 36, 0.88);
  color: #e8f2ff;
  font: 600 12px/1.2 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: -4px 8px 24px rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.avc-assist-tab:hover,
.avc-assist-tab:focus-visible {
  outline: none;
  background: rgba(28, 48, 90, 0.95);
  border-color: rgba(180, 230, 255, 0.65);
}

.avc-assist-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 92vw);
  z-index: 9600;
  display: flex;
  flex-direction: column;
  background: rgba(8, 12, 28, 0.96);
  border-left: 1px solid rgba(140, 190, 255, 0.28);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(105%);
  transition: transform 0.28s ease;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding:
    calc(env(safe-area-inset-top, 0px) + 10px)
    12px
    calc(env(safe-area-inset-bottom, 0px) + 10px)
    12px;
}

.avc-assist-panel.is-open {
  transform: translateX(0);
}

.avc-assist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.avc-assist-portrait {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  height: 96px;
  max-height: 96px;
  min-height: 72px;
  margin-bottom: 8px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(186, 140, 255, 0.4);
  box-shadow: 0 10px 28px rgba(40, 0, 70, 0.4);
  background: #120818;
}

.avc-assist-panel.is-typing .avc-assist-portrait {
  height: 0;
  min-height: 0;
  max-height: 0;
  margin: 0;
  border: 0;
}

.avc-assist-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 16%;
}

.avc-assist-title {
  font: 700 15px/1.3 "Segoe UI", system-ui, sans-serif;
  color: #f0f6ff;
}

.avc-assist-sub {
  font: 400 11px/1.3 "Segoe UI", system-ui, sans-serif;
  color: rgba(200, 220, 255, 0.7);
  margin-top: 2px;
}

.avc-assist-close {
  border: 1px solid rgba(160, 200, 255, 0.3);
  background: rgba(20, 30, 55, 0.9);
  color: #fff;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.avc-assist-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 2px 12px;
}

.avc-assist-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 92%;
}

.avc-assist-row.user { align-self: flex-end; align-items: flex-end; }
.avc-assist-row.bot { align-self: flex-start; align-items: flex-start; }

.avc-assist-who {
  font: 700 12px/1.2 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.02em;
}

.avc-assist-row.user .avc-assist-who { color: #ffd78a; }
.avc-assist-row.bot .avc-assist-who { color: #d7c4ff; }

.avc-assist-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.avc-assist-forget {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 160, 160, 0.5);
  background: rgba(90, 18, 28, 0.92);
  color: #fff;
  font: 700 16px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.avc-assist-bubble {
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  font: 400 13px/1.45 "Segoe UI", system-ui, sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
}

.avc-assist-bubble.bot {
  background: rgba(40, 70, 120, 0.55);
  border: 1px solid rgba(140, 190, 255, 0.22);
  color: #eef5ff;
}

.avc-assist-bubble.user {
  background: #fff6e4;
  border: 1px solid #e6c48a;
  color: #2a1608;
}

.avc-assist-bubble.user.is-fresh {
  box-shadow: 0 0 0 2px #f0c36a;
}

.avc-assist-bubble.pending {
  opacity: 0.75;
  font-style: italic;
}

.avc-assist-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(230, 196, 138, 0.35);
  padding-top: 10px;
  background: rgba(255, 246, 228, 0.06);
}

.avc-assist-write-label {
  font: 700 13px/1.2 "Segoe UI", system-ui, sans-serif;
  color: #ffd78a;
}

.avc-assist-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.avc-assist-live {
  flex: 1;
  min-height: 44px;
  max-height: 96px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 140, 140, 0.55);
  background: rgba(40, 12, 18, 0.92);
  color: #fff;
  padding: 10px 12px;
  font: 600 16px/1.35 "Segoe UI", system-ui, sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
}

.avc-assist-input {
  flex: 1;
  width: 100%;
  min-height: 64px;
  max-height: 140px;
  resize: none;
  border-radius: 14px;
  border: 2px solid #e6c48a;
  background: #fffaf2;
  color: #2a1608;
  padding: 12px 14px;
  font: 500 16px/1.4 "Segoe UI", system-ui, sans-serif;
  caret-color: #8a4b12;
}

.avc-assist-input::placeholder {
  color: #9a7344;
}

.avc-assist-input:focus {
  outline: none;
  border-color: #c9842a;
  box-shadow: 0 0 0 3px rgba(232, 176, 74, 0.35);
}

.avc-assist-clear {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 160, 160, 0.55);
  background: rgba(90, 18, 28, 0.92);
  color: #fff;
  font: 700 22px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

.avc-assist-mic {
  flex: 0 0 auto;
  min-width: 64px;
  height: 44px;
  border: 1px solid rgba(160, 220, 255, 0.45);
  border-radius: 12px;
  background: rgba(20, 40, 70, 0.95);
  color: #e8f6ff;
  font: 700 13px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

.avc-assist-mic.is-on {
  background: #c62828;
  border-color: #ff8a80;
  color: #fff;
  animation: avc-assist-mic-pulse 1s ease-in-out infinite;
}

@keyframes avc-assist-mic-pulse {
  50% { transform: scale(0.96); opacity: 0.85; }
}

.avc-assist-send {
  min-width: 72px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f7cff, #7b5cff);
  color: #fff;
  font: 700 13px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.avc-assist-send:disabled {
  opacity: 0.55;
  cursor: wait;
}

body.hr-lobby .avc-assist-tab,
body.hr-lobby .avc-assist-panel {
  /* keep above room stage */
  z-index: 9600;
}

@media (min-width: 768px) {
  .avc-assist-panel { width: min(420px, 92vw); }
  .avc-assist-portrait { height: 120px; max-height: 120px; }
}

@media (min-width: 1024px) {
  .avc-assist-panel { width: min(420px, 40vw); }
  .avc-assist-portrait { height: 140px; max-height: 140px; }
}

@media (max-width: 480px) {
  .avc-assist-panel {
    width: min(100vw, 100%);
  }
  .avc-assist-tab {
    top: 48%;
    padding: 12px 7px;
    font-size: 11px;
  }
}
