.sc-lanzador, .sc-panel {
    --sc-verde: #14532d;
    --sc-verde-claro: #16a34a;
    --sc-tinta: #1f2a24;
    --sc-suave: #6b7a72;
    --sc-borde: #e2e7e4;
    --sc-fondo: #f6f8f7;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.sc-lanzador {
    position: fixed; right: 20px; bottom: 20px; z-index: 1000;
    display: inline-flex; align-items: center; gap: .55rem; height: 46px; padding: 0 1.1rem 0 .5rem;
    border: 0; border-radius: 999px; cursor: pointer; color: #fff; font-size: .95rem; font-weight: 600;
    background: linear-gradient(135deg, #166534, #14532d); box-shadow: 0 10px 24px -8px rgba(20, 83, 45, .6);
    transition: transform .2s, box-shadow .2s;
}
.sc-lanzador:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -8px rgba(20, 83, 45, .7); }
.sc-lanzador__icono { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .18); font-size: .95rem; }
.sc-lanzador__eva { width: 20px; height: auto; }
.sc-lanzador__aviso {
    position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    display: grid; place-items: center; font-size: .7rem; color: #fff; background: #dc2626; border: 2px solid #fff;
    animation: sc-pulso 1.6s ease-in-out infinite;
}
.sc-lanzador[hidden], .sc-lanzador__aviso[hidden] { display: none; }

.sc-panel {
    position: fixed; right: 20px; bottom: 20px; z-index: 1090; display: flex; flex-direction: column; overflow: hidden;
    width: 380px; height: min(600px, calc(100vh - 40px)); border-radius: 18px; background: #fff; color: var(--sc-tinta);
    border: 1px solid var(--sc-borde); box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .45);
    animation: sc-entra .3s cubic-bezier(.2, .9, .3, 1.1) both;
}
.sc-panel[hidden] { display: none; }
.sc-panel.sc-saliendo { animation: sc-sale .18s ease both; }

.sc-cabecera {
    position: relative; display: grid; grid-template-columns: 76px 1fr 76px; align-items: center; padding: .7rem .8rem;
    border-bottom: 1px solid var(--sc-borde); background: #fff;
}
.sc-cabecera__botones { display: flex; gap: .15rem; }
.sc-cabecera button, .sc-menu-envoltura > button {
    display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent;
    color: var(--sc-suave); cursor: pointer; transition: background .15s, color .15s;
}
.sc-cabecera button:hover { background: var(--sc-fondo); color: var(--sc-tinta); }
.sc-cabecera__titulo { display: flex; flex-direction: column; align-items: center; gap: .1rem; text-align: center; }
.sc-cabecera__titulo strong { font-size: .95rem; }
.sc-estado { display: inline-flex; align-items: center; gap: .35rem; font-size: .62rem; font-weight: 700; letter-spacing: .06em; color: var(--sc-verde-claro); }
.sc-estado i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sc-estado.sc-estado--espera { color: #b45309; }
.sc-estado.sc-estado--off { color: var(--sc-suave); }
.sc-menu-envoltura { position: relative; justify-self: end; }
.sc-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 3; min-width: 210px; padding: .35rem; border-radius: 12px;
    background: #fff; border: 1px solid var(--sc-borde); box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .3);
    animation: sc-menu .16s ease both;
}
.sc-menu[hidden] { display: none; }
.sc-menu button {
    display: flex; align-items: center; gap: .65rem; width: 100%; height: auto; padding: .6rem .7rem; border-radius: 8px;
    font-size: .88rem; color: var(--sc-tinta); text-align: left;
}
.sc-menu button i { width: 18px; text-align: center; }
.sc-menu button[hidden] { display: none; }
.sc-menu .sc-menu__peligro { color: #b91c1c; }

.sc-cuerpo { flex: 1; overflow-y: auto; padding: 1rem .9rem .5rem; background: var(--sc-fondo); scroll-behavior: smooth; }
.sc-privacidad { margin: 0 0 1rem; text-align: center; font-size: .74rem; color: var(--sc-suave); }
.sc-privacidad a { color: var(--sc-tinta); text-decoration: underline; }
.sc-mensajes { display: flex; flex-direction: column; gap: .7rem; }
.sc-msg { max-width: 86%; display: flex; flex-direction: column; gap: .2rem; animation: sc-msg .25s ease both; }
.sc-msg__autor { display: flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 600; color: var(--sc-verde); }
.sc-msg__autor i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .55rem; color: #fff; background: var(--sc-verde-claro); }
.sc-msg__burbuja {
    padding: .6rem .8rem; border-radius: 14px; font-size: .9rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere;
    background: #fff; border: 1px solid var(--sc-borde); border-top-left-radius: 4px;
}
.sc-msg__burbuja img { display: block; max-width: 100%; max-height: 180px; border-radius: 10px; cursor: zoom-in; }
.sc-msg__burbuja img + span { display: block; margin-top: .4rem; }
.sc-msg__hora { font-size: .65rem; color: var(--sc-suave); }
.sc-msg--cliente { align-self: flex-end; align-items: flex-end; }
.sc-msg--cliente .sc-msg__burbuja { color: #fff; background: var(--sc-verde-claro); border-color: transparent; border-radius: 14px; border-top-right-radius: 4px; }
.sc-msg--sistema { align-self: center; max-width: 92%; align-items: center; }
.sc-msg--sistema .sc-msg__burbuja { background: transparent; border: 0; padding: .2rem .5rem; text-align: center; font-size: .75rem; color: var(--sc-suave); }

.sc-escribiendo { display: inline-flex; gap: 4px; margin: .6rem 0 .2rem; padding: .55rem .75rem; border-radius: 14px; background: #fff; border: 1px solid var(--sc-borde); }
.sc-escribiendo[hidden] { display: none; }
.sc-escribiendo span { width: 6px; height: 6px; border-radius: 50%; background: var(--sc-suave); animation: sc-punto 1.2s ease-in-out infinite; }
.sc-escribiendo span:nth-child(2) { animation-delay: .15s; }
.sc-escribiendo span:nth-child(3) { animation-delay: .3s; }

.sc-bajar {
    position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 2; display: grid; place-items: center;
    width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer; color: #fff; background: var(--sc-verde-claro);
    box-shadow: 0 8px 18px -6px rgba(21, 128, 61, .7); animation: sc-msg .2s ease both;
}
.sc-bajar[hidden] { display: none; }

.sc-pie { padding: .6rem .7rem .75rem; border-top: 1px solid var(--sc-borde); background: #fff; }
.sc-pie__fila { display: flex; align-items: flex-end; gap: .5rem; }
.sc-adjuntar { display: grid; place-items: center; flex: none; width: 36px; height: 40px; margin: 0; color: var(--sc-suave); cursor: pointer; transition: color .15s; }
.sc-adjuntar:hover { color: var(--sc-verde-claro); }
.sc-campo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; padding: .35rem .8rem; border-radius: 14px; border: 1px solid var(--sc-borde); background: var(--sc-fondo); transition: border-color .15s, box-shadow .15s; }
.sc-campo:focus-within { border-color: var(--sc-verde-claro); box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); background: #fff; }
.sc-campo textarea { width: 100%; max-height: 110px; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: .9rem; line-height: 1.4; padding: .1rem 0; color: var(--sc-tinta); }
.sc-adjunto { display: inline-flex; align-items: center; gap: .4rem; align-self: flex-start; max-width: 100%; padding: .15rem .5rem; border-radius: 8px; font-size: .75rem; color: var(--sc-verde); background: #e6f6ec; }
.sc-adjunto span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-adjunto button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 .1rem; }
.sc-adjunto[hidden] { display: none; }
.sc-enviar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer; color: #fff; background: var(--sc-verde-claro); transition: transform .15s, opacity .15s; }
.sc-enviar:hover { transform: scale(1.06); }
.sc-enviar:disabled { opacity: .45; cursor: default; transform: none; }
.sc-error { margin: 0 0 .5rem; padding: .45rem .7rem; border-radius: 10px; font-size: .78rem; color: #991b1b; background: #fde8e8; }
.sc-error[hidden] { display: none; }

.sc-confirmar {
    position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .8rem; padding: 2rem 1.5rem; text-align: center; background: #fff; animation: sc-msg .22s ease both;
}
.sc-confirmar[hidden] { display: none; }
.sc-confirmar h3 { margin: .5rem 0 0; font-size: 1.2rem; font-weight: 700; }
.sc-confirmar p { margin: 0 0 .8rem; font-size: .9rem; color: var(--sc-suave); }
.sc-boton { width: 100%; height: 48px; border-radius: 10px; font-size: .95rem; font-weight: 600; cursor: pointer; transition: transform .15s, background .15s; }
.sc-boton:hover { transform: translateY(-1px); }
.sc-boton--borde { color: var(--sc-verde); background: #fff; border: 2px solid var(--sc-verde-claro); }
.sc-boton--borde:hover { background: #f0faf3; }
.sc-boton--rojo { color: #fff; background: #b91c1c; border: 0; }
.sc-boton--rojo:hover { background: #991b1b; }

@keyframes sc-entra { from { opacity: 0; transform: translateY(22px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sc-sale { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes sc-msg { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sc-menu { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes sc-punto { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes sc-pulso { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }

@media (max-width: 767.98px) {
    .sc-lanzador { display: none !important; }
}

@media (max-width: 520px) {
    .sc-panel { inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
    .sc-cabecera { padding-top: max(.7rem, env(safe-area-inset-top)); }
    .sc-pie { padding-bottom: max(.75rem, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
    .sc-panel, .sc-msg, .sc-menu, .sc-confirmar, .sc-lanzador__aviso, .sc-escribiendo span, .sc-bajar { animation: none !important; }
    .sc-cuerpo { scroll-behavior: auto; }
}
.sc-msg__eva { width: 22px; height: 22px; padding: 3px; border-radius: 50%; flex: none; color: #fff; background: var(--sc-verde-claro); }
