/* ── Chat Marina ─────────────────────────────────────────── */

#sv-chat-btn {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 100px !important;
    height: 100px !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    z-index: 9999 !important;
    transition: transform .2s ease;
    display: block !important;
    line-height: 0;
}
#sv-chat-btn:hover { transform: scale(1.07); }
#sv-chat-btn img {
    width: 100px !important;
    height: 100px !important;
    display: block;
    object-fit: contain;
}

#sv-chat-win {
    position: fixed;
    bottom: 122px;
    right: 20px;
    width: 340px;
    height: 490px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 10px 44px rgba(10,61,98,.2);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    transform: scale(.94) translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition: transform .22s ease, opacity .22s ease;
}
#sv-chat-win.sv-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Header */
#sv-chat-head {
    background: linear-gradient(135deg, #0a3d62 0%, #1a6fa8 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
}
#sv-chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
#sv-chat-info { flex: 1; }
#sv-chat-name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
#sv-chat-sub  { color: rgba(255,255,255,.72); font-size: 11.5px; }
#sv-chat-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0 2px;
    transition: color .15s;
}
#sv-chat-close:hover { color: #fff; }

/* Messages */
#sv-chat-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: #f0f6fb;
    scroll-behavior: smooth;
}
#sv-chat-msgs::-webkit-scrollbar { width: 4px; }
#sv-chat-msgs::-webkit-scrollbar-thumb { background: #b8d0e8; border-radius: 2px; }

.sv-msg {
    max-width: 84%;
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}
.sv-msg.sv-bot {
    background: #fff;
    border: 1px solid #dce9f3;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: #1a2f42;
}
.sv-msg.sv-user {
    background: linear-gradient(135deg, #0a3d62, #1a6fa8);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.sv-msg.sv-typing {
    color: #7a9ab5;
    font-style: italic;
}

/* Markdown dentro de mensajes del bot */
.sv-msg.sv-bot p { margin: 0 0 6px; }
.sv-msg.sv-bot p:last-child { margin-bottom: 0; }
.sv-msg.sv-bot strong { font-weight: 700; }
.sv-msg.sv-bot h2, .sv-msg.sv-bot h3 {
    font-size: 13.5px; font-weight: 700; margin: 6px 0 4px;
}
.sv-msg.sv-bot ul, .sv-msg.sv-bot ol {
    margin: 4px 0; padding-left: 18px;
}
.sv-msg.sv-bot li { margin-bottom: 2px; }
.sv-msg.sv-bot table {
    width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0;
}
.sv-msg.sv-bot th, .sv-msg.sv-bot td {
    border: 1px solid #c8daea; padding: 4px 7px; text-align: left;
}
.sv-msg.sv-bot th { background: #e3eef7; font-weight: 700; }

/* Input area */
#sv-chat-form {
    padding: 10px 12px;
    border-top: 1px solid #e2edf5;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #fff;
    flex-shrink: 0;
}
#sv-chat-input {
    flex: 1;
    border: 1px solid #c8daea;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13.5px;
    outline: none;
    resize: none;
    font-family: inherit;
    color: #1a2f42;
    max-height: 90px;
    line-height: 1.4;
    transition: border-color .15s;
}
#sv-chat-input:focus { border-color: #1a6fa8; }
#sv-chat-send {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0a3d62, #1a6fa8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform .15s, opacity .15s;
}
#sv-chat-send:hover { transform: scale(1.1); }
#sv-chat-send:disabled { opacity: .5; cursor: default; transform: none; }
#sv-chat-send svg { width: 15px; height: 15px; fill: #fff; }

@media (max-width: 420px) {
    #sv-chat-win { width: calc(100vw - 20px); right: 10px; bottom: 78px; }
    #sv-chat-btn { bottom: 16px; right: 16px; }
}
