/* WebChat UI - design moderno minimal supply-chain, IBM Plex.
   Tutte le classi prefissate "vp-" per non collidere col portale ospite.
   Token theme definiti sul container .vp-app per scoping completo. */

.vp-app {
  /* Accent allineato al colore primario del portale (Fluent blue #0078d4). */
  --accent: #0078d4;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, white);
  --accent-on: #ffffff;

  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-2: #F5F5F2;
  --border: #E7E6E1;
  --border-strong: #D4D3CC;
  --text: #16161A;
  --text-2: #5B5B57;
  --text-3: #8A8A85;
  --bubble-other: #F1F1ED;
  --bubble-other-text: #16161A;
  --shadow-sm: 0 1px 2px rgba(20,20,20,0.04), 0 1px 1px rgba(20,20,20,0.03);
  --shadow-md: 0 8px 24px rgba(20,20,20,0.08), 0 2px 6px rgba(20,20,20,0.04);
  --radius-bubble: 18px;
  --radius-bubble-tight: 6px;

  --row-gap: 4px;
  --bubble-pad-y: 9px;
  --bubble-pad-x: 13px;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  font-family: var(--font-sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";

  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  height: 100%;
  min-height: 320px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  /* Widget standalone Infor OS: la sidebar puo' essere molto stretta.
     Blocco l'asse X per evitare scrollbar orizzontale anche se il
     contenuto deborda transitoriamente (es. allegati con nomi lunghi). */
  overflow-x: hidden;
  min-width: 0;
}

.vp-app[data-theme="dark"] {
  --bg: #0F1115;
  --surface: #15181E;
  --surface-2: #1B1F26;
  --border: #262A33;
  --border-strong: #353A45;
  --text: #ECECEC;
  --text-2: #A4A6AA;
  --text-3: #6D7077;
  --bubble-other: #232831;
  --bubble-other-text: #ECECEC;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 12px 32px rgba(0,0,0,0.5);
  --accent-soft: color-mix(in srgb, var(--accent) 25%, #0F1115);
}

.vp-app[data-density="compact"] {
  --row-gap: 2px;
  --bubble-pad-y: 6px;
  --bubble-pad-x: 11px;
}

.vp-app * { box-sizing: border-box; }
.vp-app button { font-family: inherit; }

@media (max-width: 980px) {
  .vp-app { border-left: none; border-right: none; max-width: 100%; }
}

/* ============ Top header ============ */

.vp-app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}

/* Modalita' compatta: la sidebar portale e' stretta (~420px), brand-text
   nascosto cosi' la combo topic e le bolle hanno piu' spazio. */
.vp-app-compact .vp-app-header {
  padding: 10px 12px;
  gap: 8px;
}
.vp-app-compact .vp-brand-text { display: none; }

.vp-brand { display: flex; align-items: center; gap: 10px; }
.vp-brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: var(--accent-on);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}
.vp-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.vp-brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.vp-brand-sub { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); letter-spacing: 0.02em; }

@media (max-width: 640px) {
  .vp-brand-text { display: none; }
  .vp-app-header { padding: 12px; gap: 10px; }
}

.vp-header-actions { display: flex; gap: 6px; }

.vp-icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.vp-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.vp-icon-btn.is-active { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }

.vp-icon-btn-sm {
  width: 28px; height: 28px; border-radius: 8px;
  border: none; background: transparent; color: var(--text-3);
  cursor: pointer; display: grid; place-items: center;
}
.vp-icon-btn-sm:hover { color: var(--text); background: var(--surface-2); }

/* ============ Combo box ============ */

.vp-combo { position: relative; min-width: 0; }

.vp-combo-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, border-color .15s;
}
.vp-combo-trigger:hover { background: var(--surface); border-color: var(--border-strong); }
.vp-combo.is-open .vp-combo-trigger {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.vp-combo-trigger-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vp-combo-line1 {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.vp-combo-line2 {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.vp-combo-title {
  font-size: 14px; font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  min-width: 0;
}
.vp-combo-chev { color: var(--text-3); transition: transform .2s; flex-shrink: 0; }
.vp-combo.is-open .vp-combo-chev { transform: rotate(180deg); color: var(--accent); }

.vp-combo-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  overflow: hidden;
  animation: vp-combo-in .14s ease-out;
}
@keyframes vp-combo-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.vp-combo-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.vp-combo-count {
  background: var(--surface-2);
  color: var(--text-2);
  padding: 2px 7px; border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.vp-combo-list { max-height: 60vh; overflow-y: auto; padding: 4px; }

.vp-combo-item {
  width: 100%;
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.vp-combo-item:hover { background: var(--surface-2); }
.vp-combo-item.is-active { background: var(--accent-soft); }
.vp-combo-item.is-active .vp-combo-item-code { background: var(--accent); color: var(--accent-on); }

.vp-combo-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vp-combo-item-row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vp-combo-item-code {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 500;
}
.vp-combo-item-time {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-3);
  white-space: nowrap;
}
.vp-combo-item-row2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vp-combo-item-name { font-weight: 600; font-size: 14px; color: var(--text); }
.vp-combo-item-row3 {
  font-size: 13px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vp-combo-item.is-active .vp-combo-item-row3 { color: var(--text); }

.vp-badge {
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  display: inline-grid; place-items: center;
}

/* ============ Topic bar (chat header) ============ */

.vp-topic-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.vp-topic-bar-left { display: flex; gap: 12px; align-items: center; min-width: 0; }
.vp-topic-bar-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.vp-topic-bar-info { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.vp-topic-bar-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.vp-topic-bar-meta {
  font-size: 12px; color: var(--text-3);
  display: flex; gap: 6px; align-items: center;
  white-space: nowrap;
}
.vp-dot-sep { color: var(--text-3); }
.vp-presence-online { color: var(--accent); font-weight: 500; }
.vp-presence-online::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 99px;
  background: var(--accent); margin-right: 4px; vertical-align: middle;
}

.vp-topic-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 9px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
  line-height: 1;
}

.vp-topic-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  font-size: 12px;
  font-weight: 500;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1;
}
.vp-topic-close-btn:hover:not(:disabled) {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.vp-topic-close-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .vp-topic-bar { padding: 10px 12px; }
  .vp-topic-bar-right { display: none; }
  .vp-topic-bar-meta { font-size: 11px; }
}

/* ============ Avatar ============ */

.vp-avatar {
  position: relative;
  border-radius: 50%;
  color: white;
  display: grid; place-items: center;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.vp-avatar-dot {
  position: absolute;
  right: -1px; bottom: -1px;
  width: 30%; height: 30%;
  min-width: 8px; min-height: 8px;
  max-width: 12px; max-height: 12px;
  border-radius: 99px;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}
.vp-avatar-dot.is-online { background: #22C55E; }
.vp-avatar-dot.is-offline { background: var(--text-3); }

/* ============ Search bar ============ */

.vp-search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  animation: vp-combo-in .14s ease-out;
}
.vp-search-bar input {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  font-family: inherit; font-size: 14px;
  color: var(--text);
  outline: none;
  padding: 6px 0;
}
.vp-search-bar-ico { color: var(--text-3); flex-shrink: 0; }
.vp-search-count {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
}

/* ============ Messages ============ */

.vp-messages {
  overflow-y: auto;
  /* Senza overflow-x esplicito il browser promuove l'asse X da `visible`
     ad `auto` (spec CSS overflow) e fa comparire la scrollbar orizzontale
     non appena una bolla o un allegato sfiora il bordo. Forzo `hidden`. */
  overflow-x: hidden;
  min-width: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--border) 60%, transparent) 1px, transparent 0);
  background-size: 24px 24px;
}
.vp-app[data-theme="dark"] .vp-messages {
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--border) 80%, transparent) 1px, transparent 0);
}

.vp-messages-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: var(--row-gap);
  min-width: 0;
}

@media (max-width: 640px) {
  .vp-messages-inner { padding: 14px 10px 18px; }
}

/* ----- day divider ----- */
.vp-day-divider {
  display: flex; align-items: center; justify-content: center;
  margin: 14px 0 8px;
}
.vp-day-divider span {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-3);
  background: var(--bg);
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
}

/* ----- rows ----- */
.vp-row {
  display: grid;
  /* minmax(0, 1fr) anziche' 1fr: permette ai grid-item di shrinkare sotto
     il loro min-content; serve per spezzare le parole lunghissime via
     overflow-wrap:anywhere senza far esplodere la larghezza della riga. */
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  align-items: flex-end;
  margin-top: 8px;
  min-width: 0;
}
.vp-row.grouped-top { margin-top: var(--row-gap); }

.vp-row-me {
  grid-template-columns: minmax(0, 1fr);
}

.vp-row-avatar { display: flex; align-items: flex-end; justify-content: center; }

.vp-bubble-col {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  min-width: 0;
}
.vp-row-me .vp-bubble-col { align-items: flex-end; margin-left: auto; }
.vp-row-them .vp-bubble-col { align-items: flex-start; }

/* ----- bubble ----- */
.vp-bubble {
  padding: var(--bubble-pad-y) var(--bubble-pad-x);
  border-radius: var(--radius-bubble);
  font-size: 14.5px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.vp-bubble-them {
  background: var(--bubble-other);
  color: var(--bubble-other-text);
  border-bottom-left-radius: var(--radius-bubble-tight);
}
.vp-bubble-me {
  background: var(--accent);
  color: var(--accent-on);
  border-bottom-right-radius: var(--radius-bubble-tight);
}

.vp-row.grouped-top .vp-bubble-them { border-top-left-radius: var(--radius-bubble-tight); }
.vp-row.grouped-top .vp-bubble-me { border-top-right-radius: var(--radius-bubble-tight); }
.vp-row.grouped-bottom .vp-bubble-them { border-bottom-left-radius: var(--radius-bubble); }
.vp-row.grouped-bottom .vp-bubble-me { border-bottom-right-radius: var(--radius-bubble); }

.vp-bubble-text {
  white-space: pre-wrap;
  text-wrap: pretty;
}

.vp-bubble-meta {
  display: flex; gap: 5px; align-items: center;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  justify-content: flex-end;
}
.vp-bubble-me .vp-bubble-meta { color: color-mix(in srgb, var(--accent-on) 75%, transparent); }

.vp-bubble-status { display: inline-flex; align-items: center; }
.vp-bubble-status.status-sending { opacity: 0.7; }
.vp-bubble-status.status-sent { opacity: 0.85; }
.vp-bubble-status.status-delivered { opacity: 0.85; }
.vp-bubble-status.status-read { color: color-mix(in srgb, var(--accent) 25%, white); opacity: 1; }
.vp-app[data-theme="dark"] .vp-bubble-status.status-read { color: color-mix(in srgb, var(--accent) 50%, white); }

.vp-status-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 99px;
  border-top-color: transparent;
  animation: vp-spin .8s linear infinite;
}
@keyframes vp-spin { to { transform: rotate(360deg); } }

.vp-hl {
  background: #FDE68A;
  color: #1F2937;
  padding: 0 2px;
  border-radius: 3px;
}

/* ----- attachment ----- */
.vp-attach {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 10px;
  background: color-mix(in srgb, currentColor 8%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  border-radius: 10px;
  margin-bottom: 6px;
  /* width:100% + min-width:0 garantiscono shrink completo dentro bolle strette
     (widget standalone Infor OS); max-width mantiene il cap "estetico". */
  width: 100%;
  min-width: 0;
  max-width: 280px;
  text-decoration: none;
  color: inherit;
}
.vp-bubble-me .vp-attach {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.25);
}
.vp-attach-ico {
  width: 36px; height: 36px;
  background: color-mix(in srgb, currentColor 15%, transparent);
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.vp-bubble-me .vp-attach-ico { background: rgba(255,255,255,0.2); }
.vp-attach-meta { min-width: 0; flex: 1; }
.vp-attach-name {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vp-attach-size {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.7;
}

/* Allegato immagine: thumbnail inline cliccabile per ingrandire */
.vp-attach-image {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 280px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  margin-bottom: 6px;
}
.vp-attach-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: contain;
  background: #f5f5f5;
}
/* Thumbnail SmallPreview IDM (PNG ~5-30 KB). Crop morbido a 200px di altezza
   per uniformare l'aspetto fra immagini, PDF, docx, xlsx, ecc. */
.vp-attach-image img.vp-attach-thumb {
  max-height: 200px;
  object-fit: cover;
}
.vp-attach-image-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
}
.vp-attach-image-name {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vp-attach-image-size {
  font-family: var(--font-mono);
  opacity: 0.7;
}
.vp-bubble-me .vp-attach-image { border-color: rgba(255,255,255,0.25); }

/* Composer drop-hover: bordo evidenziato durante drag-over locale sulla riga
   composer (classe applicata da composer.js sul container .vp-composer). */
.vp-composer.vp-drop-hover {
  outline: 2px dashed var(--accent, #0078d4);
  outline-offset: -4px;
  background: var(--surface-2);
}

/* Dropzone estesa a tutta l'area chat: overlay con bordo tratteggiato,
   sfondo accent traslucido e dicitura centrale. Lavora insieme a
   composer.js che applica .vp-drop-hover sul container .vp-app durante
   il drag-and-drop di un file. */
.vp-app.vp-drop-hover {
  position: relative;
}
.vp-app.vp-drop-hover::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 14px;
  border: 3px dashed var(--accent, #0078d4);
  background: color-mix(in srgb, var(--accent, #0078d4) 10%, transparent);
  pointer-events: none;
  z-index: 900;
  animation: vp-drop-pulse 1.4s ease-in-out infinite;
}
.vp-app.vp-drop-hover::after {
  content: "Rilascia qui per allegare il file";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--accent, #0078d4);
  text-shadow: 0 1px 2px rgba(255,255,255,0.6);
  pointer-events: none;
  z-index: 901;
}
@keyframes vp-drop-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}
/* Mentre l'overlay e' attivo, smorziamo il contenuto sotto per dare focus
   visivo al messaggio "rilascia qui". */
.vp-app.vp-drop-hover > * { opacity: 0.55; transition: opacity .15s; }

/* Popup conferma upload */
.vp-confirm-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.vp-confirm-card {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 48px rgba(0,0,0,0.25);
  width: min(420px, calc(100vw - 32px));
  display: flex; flex-direction: column;
}
.vp-confirm-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.vp-confirm-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.vp-confirm-body {
  display: flex; gap: 14px; align-items: center;
  padding: 16px;
}
.vp-confirm-preview {
  width: 96px; height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: #f5f5f5;
}
.vp-confirm-file-ico {
  width: 96px; height: 96px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.vp-confirm-meta { flex: 1; min-width: 0; }
.vp-confirm-name {
  font-size: 14px; font-weight: 600; margin-bottom: 4px;
  word-break: break-word;
}
.vp-confirm-sub {
  font-size: 12px; color: var(--text-3);
  font-family: var(--font-mono);
}
.vp-confirm-source {
  margin-top: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.vp-confirm-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}
.vp-btn {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.vp-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.vp-btn-ghost:hover { background: var(--surface-2); }
.vp-btn-accent {
  background: var(--accent, #0078d4);
  color: #fff;
  border-color: var(--accent, #0078d4);
}
.vp-btn-accent:hover:not(:disabled) { filter: brightness(1.05); }

/* ----- typing ----- */
.vp-bubble.typing {
  padding: 12px 14px;
  display: inline-flex; gap: 4px; align-items: center;
}
.vp-bubble.typing span {
  width: 6px; height: 6px; border-radius: 99px;
  background: var(--text-3);
  animation: vp-bounce 1.2s infinite ease-in-out;
}
.vp-bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.vp-bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes vp-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.vp-empty-search {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

/* ============ Composer ============ */

.vp-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.vp-composer-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
  position: relative;
  overflow: hidden;
}
.vp-composer-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.vp-composer-btn input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.vp-composer-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: stretch;
  transition: border-color .15s, background .15s;
}
.vp-composer-input:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.vp-composer-input textarea {
  width: 100%;
  border: none; outline: none; background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
  padding: 0;
  /* Altezza fissa: sempre 3 righe visibili; oltre 3 righe scrolla. */
  height: calc(1.45em * 3);
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.vp-composer-input textarea::placeholder { color: var(--text-3); }

.vp-composer-send {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--accent-on);
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .1s, filter .15s;
}
.vp-composer-send:hover:not(:disabled) { filter: brightness(1.08); }
.vp-composer-send:active:not(:disabled) { transform: scale(0.95); }
.vp-composer-send:disabled { opacity: 0.45; cursor: default; }

/* ============ Scrollbar ============ */
.vp-messages::-webkit-scrollbar, .vp-combo-list::-webkit-scrollbar { width: 10px; }
.vp-messages::-webkit-scrollbar-thumb, .vp-combo-list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--border-strong) 70%, transparent);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.vp-messages::-webkit-scrollbar-thumb:hover, .vp-combo-list::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
  background-clip: padding-box;
  border: 2px solid transparent;
}
