﻿/* ============================================================
   QuedaListo — Mensajes CLIENTE (dark theme)
   ============================================================ */

:root {
    --bg:           #0b0f14;
    --card:         #121821;
    --card-2:       #0f141b;
    --card-hover:   #18202a;
    --border:       #1f2937;
    --border-soft:  #29323f;

    --text:         #ffffff;
    --muted:        #9ca3af;
    --text-soft:    #6b7280;

    --primary:      var(--ql-primario);
    --primary-hov:  var(--ql-primario-hover);
    --azul:         #3b82f6;
    --green:        #22c55e;
    --red:          #ef4444;
    --naranja:      var(--ql-primario);

    --sidebar-bg:   #0a0a0a;
    --sidebar-hover:#16181c;

}

/* ===== Tema claro (día) ===== */
html[data-theme="light"] {
    /* estados más oscuros para que se lean sobre blanco */
    --green: #15803d; --yellow: #d97706; --red: #dc2626; --blue: #2563eb;
    --bg:           #eef2f6;
    --card:         #ffffff;
    --card-2:       #f6f8fa;
    --card-hover:   #eef2f6;
    --border:       #e2e8f0;
    --border-soft:  #cbd5e1;
    --text:         #0f172a;
    --muted:        #64748b;
    --text-soft:    #94a3b8;
    --sidebar-bg:   #ffffff;
    --sidebar-hover:#f1f5f9;
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.offline-bar, .topbar-user-btn, .topbar-user-popup { display: none !important; }
.bottom-nav { display: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: 100vh;
    height: 100dvh;
}

/* ============================================================
   SIDEBAR (cliente dark — mismo patrón)
   ============================================================ */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    padding: 0;
}

.sidebar-logo {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.sidebar-logo-img { width: 66%; height: auto; object-fit: contain; display: block; }

.sidebar-nav {
    display: flex; flex-direction: column;
    gap: 2px; padding: 12px 10px; flex: 1;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    color: var(--muted);
    padding: 12px 14px; border-radius: 10px;
    font-size: 14px; font-weight: 600;
    text-decoration: none;
    transition: background .18s, color .18s;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--sidebar-hover); color: var(--text); }
.sidebar-nav a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px rgb(var(--ql-primario-rgb) / .3);
}
.nav-badge {
    margin-left: auto;
    background: var(--primary); color: #fff;
    border-radius: 999px;
    min-width: 22px; height: 22px;
    padding: 0 7px;
    font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-nav a.active .nav-badge { background: var(--text); color: var(--primary); }

.sidebar-avatar-wrap {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 14px 14px 8px !important;
    margin-top: auto;
    border-top: 1px solid var(--border);
}
.sidebar-avatar-big {
    width: 36px !important; height: 36px !important;
    border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px !important; font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-avatar-wrap strong {
    font-size: 13px !important;
    font-weight: 700; color: var(--text) !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-align: left !important;
    align-self: center;
}
.sidebar-avatar-role { display: none !important; }

.sidebar-help { display: none !important; }

.btn-logout {
    margin: 0 14px 18px !important;
    padding: 10px !important;
    background: transparent !important;
    border: 1px solid var(--border-soft) !important;
    color: var(--text) !important;
    border-radius: 10px !important;
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: border-color .18s, color .18s, background .18s;
    font-family: 'DM Sans', sans-serif !important;
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: rgb(var(--ql-primario-rgb) / .06) !important;
}

/* ============================================================
   MAIN
   ============================================================ */
.main-area {
    display: flex; flex-direction: column;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.topbar {
    height: 64px;
    background: var(--bg);
    border-bottom: 1px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    flex-shrink: 0;
}
.mob-menu-btn {
    display: none;
    width: 36px; height: 36px;
    background: none; border: none; border-radius: 8px;
    color: var(--text); cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0; padding: 0;
}
.mob-menu-btn svg, .mob-menu-btn i { width: 22px; height: 22px; }
.topbar-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    flex: 1;
}

/* ============================================================
   CHAT LAYOUT (panel lista + área de mensajes)
   ============================================================ */
.chat-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr;
    background: var(--bg);
    overflow: hidden;
    min-height: 0;
}

/* ---- Panel de conversaciones ---- */
.chat-sidebar {
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.chat-sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.chat-sidebar-header h2 {
    font-size: 16px; font-weight: 800; color: var(--text); margin: 0;
}
.chat-compose-btn {
    width: 32px; height: 32px;
    background: var(--card-2);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s, color .15s;
}
.chat-compose-btn:hover { border-color: var(--primary); color: var(--primary); }
.chat-compose-btn svg { width: 15px; height: 15px; }

.chat-search-wrap {
    position: relative;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.chat-search-wrap svg {
    position: absolute;
    left: 24px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px;
    color: var(--muted);
}
.chat-search-input {
    width: 100%;
    background: var(--card-2);
    border: 1px solid var(--border-soft);
    color: var(--text);
    padding: 9px 12px 9px 34px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    transition: border-color .15s;
}
.chat-search-input::placeholder { color: var(--text-soft); }
.chat-search-input:focus { border-color: var(--primary); background: var(--card-2); }

.chat-lista {
    flex: 1;
    overflow-y: auto;
}
.chat-lista::-webkit-scrollbar { width: 6px; }
.chat-lista::-webkit-scrollbar-track { background: transparent; }
.chat-lista::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 3px; }

.chat-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .15s;
}
.chat-item:hover { background: var(--card-hover); }
.chat-item.active {
    background: rgb(var(--ql-primario-rgb) / .08);
    border-left: 3px solid var(--primary);
    padding-left: 11px;
}
.chat-item.unread .chat-name { font-weight: 800; }
.chat-item.unread .chat-last { color: var(--text); font-weight: 500; }

.chat-avatar-wrap { position: relative; flex-shrink: 0; }
.chat-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: var(--text);
    overflow: hidden;
    flex-shrink: 0;
    letter-spacing: -.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }

.status-dot {
    position: absolute;
    bottom: 0; right: 0;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--card);
}
.status-dot.offline { background: var(--text-soft); }

.chat-info { flex: 1; min-width: 0; }
.chat-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-last {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.chat-meta {
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}
.chat-hora { font-size: 11px; color: var(--muted); }
.chat-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    min-width: 18px; height: 18px;
    padding: 0 6px;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}

/* ---- Área de mensajes ---- */
.chat-main {
    flex: 1;
    display: flex; flex-direction: column;
    background: var(--bg);
    overflow: hidden;
    min-width: 0;
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    padding: 40px;
    text-align: center;
}
.chat-empty svg {
    width: 64px; height: 64px;
    color: var(--text-soft);
    margin-bottom: 12px;
    stroke: currentColor;
}
.chat-empty p { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.chat-empty small { font-size: 13px; color: var(--muted); }

.chat-main-header {
    display: flex; align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-back-btn {
    display: none;
    border: none; background: transparent;
    cursor: pointer; color: var(--muted);
    padding: 6px; border-radius: 8px;
}
.chat-back-btn:hover { background: var(--card-hover); }
.chat-back-btn svg { width: 20px; height: 20px; }

.chat-header-avatar-wrap { position: relative; }
.chat-header-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--card-2);
    border: 1px solid var(--border-soft);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: var(--primary);
}
.chat-header-status {
    position: absolute;
    bottom: 0; right: 0;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--card);
}

.chat-header-info { flex: 1; min-width: 0; }
.chat-main-name {
    font-size: 15px; font-weight: 800;
    color: var(--text);
}
.chat-main-sub {
    font-size: 12px; color: var(--muted);
    margin-top: 1px;
    display: flex; align-items: center; gap: 4px;
}
.chat-main-sub .online-label { color: var(--green); font-weight: 700; }

.chat-header-actions {
    display: flex; align-items: center; gap: 8px;
}
.btn-acuerdo {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px;
    background: rgba(34, 197, 94, .12);
    border: 1px solid rgba(34, 197, 94, .35);
    color: var(--green);
    border-radius: 8px;
    font-size: 12px; font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}
.btn-acuerdo:hover { background: rgba(34, 197, 94, .2); }
.btn-acuerdo svg { width: 15px; height: 15px; }

.btn-more {
    width: 34px; height: 34px;
    background: transparent;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s, color .15s;
}
.btn-more:hover { border-color: var(--primary); color: var(--primary); }
.btn-more svg { width: 16px; height: 16px; }

/* Banner turno activo */
.banner-turno {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 18px 11px 20px;
    background: var(--card);
    border-bottom: 1px solid rgba(255,255,255,.07);
    border-left: 4px solid var(--bt-color, var(--ql-primario-claro));
}
.banner-turno[data-estado="agendado"],
.banner-turno[data-estado="pendiente_confirmacion"] {
    --bt-color: var(--ql-primario-claro); --bt-badge-bg: rgba(129,140,248,.15); --bt-badge-color: #a5b4fc;
}
.banner-turno[data-estado="en_curso"] {
    --bt-color: var(--st-orange, var(--ql-primario-claro)); --bt-badge-bg: rgba(251,146,60,.15); --bt-badge-color: #fdba74;
}
.banner-turno[data-estado="completado"] {
    --bt-color: #22c55e; --bt-badge-bg: rgba(34,197,94,.15); --bt-badge-color: var(--st-green, #4ade80);
}
.banner-turno[data-estado="disputa"] {
    --bt-color: var(--st-red, #f87171); --bt-badge-bg: rgba(248,113,113,.15); --bt-badge-color: #fca5a5;
}
.banner-turno-info { flex: 1; min-width: 0; margin-right: 12px; }
.banner-turno-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.banner-turno-badge {
    font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 999px;
    background: var(--bt-badge-bg, rgba(129,140,248,.15));
    color: var(--bt-badge-color, #a5b4fc);
    white-space: nowrap; flex-shrink: 0;
}
.banner-turno-desc {
    font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.banner-turno-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.btn-ver-detalles {
    background: transparent;
    color: var(--bt-color, var(--ql-primario-claro));
    border: 1px solid var(--bt-color, var(--ql-primario-claro));
    padding: 6px 12px; border-radius: 7px;
    font-size: 12px; font-weight: 700;
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
    transition: background .15s;
    font-family: inherit;
    opacity: .85;
}
.btn-ver-detalles:hover { background: var(--bt-badge-bg, rgba(129,140,248,.15)); opacity: 1; }

/* Mensajes */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 3px; }

.date-sep {
    align-self: center;
    margin: 12px 0 8px;
    background: var(--card);
    color: var(--muted);
    font-size: 11px; font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* Mensajes */
.msg-wrap {
    display: flex;
    margin-bottom: 4px;
}
.msg-wrap.mine { justify-content: flex-end; }
.msg-wrap.theirs { justify-content: flex-start; }

.msg-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}
.msg-wrap.mine .msg-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.msg-wrap.theirs .msg-bubble {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.msg-time {
    font-size: 10px;
    color: var(--text-soft);
    margin-top: 3px;
    text-align: right;
}

/* Typing indicator */
.typing-indicator {
    color: var(--green);
    font-size: 12px;
    font-style: italic;
    animation: typing-pulse 1.4s ease-in-out infinite;
}
@keyframes typing-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .5; }
}

/* Input bar */
.chat-input-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 18px;
    background: var(--card);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-input-icon {
    width: 36px; height: 36px;
    background: transparent;
    border: none; border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: color .15s, background .15s;
}
.chat-input-icon:hover { color: var(--primary); background: var(--card-hover); }
.chat-input-icon svg { width: 18px; height: 18px; }

/* Info de horarios en modal acuerdo */
.horarios-info {
    background: rgba(59,130,246,.12);
    border: 1px solid rgba(59,130,246,.3);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: #93c5fd;
    margin-bottom: 12px;
}

/* Menú adjuntar estilo WhatsApp */
.chat-attach-wrap { position: relative; }
.chat-attach-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 8px 28px rgba(0,0,0,.5);
    z-index: 200;
    min-width: 150px;
    flex-direction: column;
    gap: 2px;
}
.chat-attach-menu.open { display: flex; }
.chat-attach-opt {
    display: flex; align-items: center; gap: 10px;
    background: none; border: none;
    color: var(--text); font-family: inherit;
    padding: 10px 12px; border-radius: 8px;
    cursor: pointer; font-size: 14px; font-weight: 500;
    transition: background .15s;
    width: 100%;
}
.chat-attach-opt:hover { background: var(--card-hover); color: var(--primary); }
.chat-attach-opt svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }

.chat-input {
    flex: 1;
    background: var(--card-2);
    border: 1px solid var(--border-soft);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color .15s;
    min-width: 0;
}
.chat-input::placeholder { color: var(--text-soft); }
.chat-input:focus { border-color: var(--primary); }

.btn-send {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px; font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}
.btn-send:hover { background: var(--primary-hov); }
.btn-send svg { width: 14px; height: 14px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .app-layout { grid-template-columns: 220px 1fr; }
    .chat-layout { grid-template-columns: 280px 1fr; }
}

@media (max-width: 768px) {
    body { background: var(--bg); overflow: hidden; height: 100dvh; }
    .app-layout { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
    .main-area {
        flex: 1; min-height: 0;
        display: flex; flex-direction: column;
        overflow: hidden;
        padding-bottom: 0;
    }
    .mob-menu-btn { display: flex !important; }
    .sidebar { width: 280px !important; background: var(--sidebar-bg); }

    .topbar { padding: 0 14px; height: 56px; flex-shrink: 0; gap: 10px; }
    .topbar-title { font-size: 17px; }

    .chat-layout {
        flex: 1; min-height: 0;
        grid-template-columns: 1fr;
        position: relative;
        overflow: hidden;
    }
    .chat-sidebar {
        width: 100%;
        height: 100%;
    }
    /* Chat activo: ocupa toda la pantalla encima de la lista */
    .chat-main {
        position: fixed;
        top: 56px; left: 0; right: 0;
        bottom: 0;
        background: var(--bg);
        z-index: 50;
        display: none;
        flex-direction: column;
    }
    .chat-main.show, .chat-main.open { display: flex; }
    .chat-back-btn { display: flex; align-items: center; justify-content: center; }
    .btn-acuerdo span, .btn-acuerdo-txt { display: none; }
    .btn-acuerdo { padding: 7px 9px; gap: 0; }
    .btn-more { display: none; }
    .btn-send span { display: none; }
    .chat-main-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .chat-main-sub  { white-space: nowrap; overflow: hidden; min-width: 0; }
    .chat-main-header { gap: 8px; }
    .chat-input-bar {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        flex-shrink: 0;
    }
    .chat-messages {
        flex: 1; min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 14px 12px;
    }
    .emoji-panel {
        grid-template-columns: repeat(7, 1fr);
        max-height: 200px;
    }
    .emoji-item { font-size: 24px; padding: 8px 4px; }
    .chat-main-header { padding: 10px 14px; flex-shrink: 0; }
    .chat-input { font-size: 16px; } /* Evita zoom en iOS */
}

/* ============================================================
   MODAL ACUERDO — fix crítico: faltan estilos
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.75);
    z-index: 1000;
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay[style*="flex"] { display: flex !important; }

.modal-box {
    background: #151e2a;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    width: 100%; max-width: 500px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.6);
    animation: modalSlideIn .2s ease;
}
@keyframes modalSlideIn {
    from { opacity:0; transform:translateY(20px) scale(.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

.modal-header {
    display:flex; align-items:center; justify-content:space-between;
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size:16px; font-weight:700; color:var(--text); }
.modal-close {
    width:30px; height:30px; background:transparent;
    border: 1px solid var(--border-soft); color:var(--muted);
    font-size:18px; line-height:1; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    border-radius:8px; transition:border-color .15s,color .15s;
}
.modal-close:hover { border-color:var(--primary); color:var(--primary); }

.modal-note {
    font-size:12px; color:var(--muted); line-height:1.5;
    background:rgba(255,255,255,.04); border-radius:8px;
    padding:10px 14px; margin-bottom:16px;
}
.modal-body  { padding: 20px 24px; }
.modal-footer {
    padding: 14px 24px 20px;
    display:flex; gap:10px; justify-content:flex-end;
    border-top: 1px solid var(--border);
}

.form-group { margin-bottom:16px; }
.form-group label {
    display:block; font-size:11px; font-weight:700;
    color:var(--muted); margin-bottom:6px;
    text-transform:uppercase; letter-spacing:.6px;
}
.form-control {
    width:100%; background:var(--card-2);
    border:1px solid var(--border-soft); color:var(--text);
    padding:10px 14px; border-radius:8px;
    font-size:14px; font-family:inherit; outline:none;
    transition:border-color .15s;
}
.form-control:focus { border-color:var(--primary); }
.form-control::placeholder { color:var(--text-soft); }
textarea.form-control { resize:vertical; min-height:72px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }

.metodo-pago-wrap { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.metodo-pago-opt {
    background:var(--card-2); border:1.5px solid var(--border-soft);
    border-radius:10px; padding:12px;
    text-align:center; cursor:pointer;
    transition:border-color .15s, background .15s;
}
.metodo-pago-opt.selected { border-color:var(--primary); background:rgb(var(--ql-primario-rgb) / .08); }
.metodo-pago-icon { font-size:22px; margin-bottom:4px; }
.metodo-pago-label { font-size:13px; font-weight:700; color:var(--text); display:block; }
.metodo-pago-sub   { font-size:11px; color:var(--muted); }

.disclaimer-box {
    margin-top:10px;
    background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.25);
    border-radius:8px; padding:12px;
    font-size:12px; color:var(--muted); line-height:1.4;
}
.disclaimer-check {
    display:flex; align-items:flex-start; gap:8px;
    margin-top:8px; cursor:pointer; color:var(--muted);
}
.alert-acuerdo { display:none; padding:10px 14px; border-radius:8px; font-size:13px; margin-bottom:14px; }
.alert-acuerdo.show { display:block; background:rgba(239,68,68,.1); border:1px solid rgba(239,68,68,.3); color:#ef4444; }

.btn-modal {
    padding:10px 20px; border-radius:8px; font-size:13px; font-weight:700;
    cursor:pointer; font-family:inherit; border:none;
    display:inline-flex; align-items:center; gap:6px;
    transition:background .15s, opacity .15s;
}
.btn-modal-ghost { background:var(--card-hover); border:1px solid var(--border-soft); color:var(--muted); }
.btn-modal-ghost:hover { color:var(--text); }
.btn-modal-success { background:#16a34a; color:var(--text); }
.btn-modal-success:hover { background:#15803d; }
.btn-modal-success:disabled { opacity:.5; cursor:default; }
.btn-modal-success svg { width:15px; height:15px; }

/* ============================================================
   BURBUJAS — clases usadas por el JS
   ============================================================ */
.msg-row {
    display:flex; align-items:flex-end; gap:8px;
    margin-bottom:2px;
}
.msg-row.enviado  { justify-content:flex-end; }
.msg-row.recibido { justify-content:flex-start; }

.msg-avatar {
    width:30px; height:30px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    font-size:11px; font-weight:800; color:var(--text); flex-shrink:0;
    letter-spacing:-.5px; box-shadow:0 2px 8px rgba(0,0,0,.35);
}
.chat-avatar {
    width:42px; height:42px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    font-size:14px; font-weight:800; color:var(--text); flex-shrink:0;
    letter-spacing:-.5px; box-shadow:0 2px 8px rgba(0,0,0,.35);
}
.chat-header-avatar {
    width:38px; height:38px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    font-size:13px; font-weight:800; color:var(--text); flex-shrink:0;
    box-shadow:0 2px 8px rgba(0,0,0,.35);
}
.chat-header-avatar-wrap { position:relative; flex-shrink:0; }
.chat-header-status {
    width:10px; height:10px; border-radius:50%;
    position:absolute; bottom:0; right:0;
    border:2px solid var(--sidebar-bg);
    background:var(--muted);
}
.chat-header-status.online  { background:var(--green); }
.chat-header-status.offline { background:var(--muted); }

.chat-message {
    max-width:68%; padding:10px 14px;
    border-radius:16px;
    font-size:14px; line-height:1.45; word-break:break-word;
}
.chat-message.enviado {
    background:var(--primary); color:#fff;
    border-bottom-right-radius:4px;
    box-shadow:0 2px 12px rgb(var(--ql-primario-rgb) / .2);
}
.chat-message.recibido {
    background:var(--card); color:var(--text);
    border:1px solid var(--border);
    border-bottom-left-radius:4px;
}
.msg-footer { display:flex; align-items:center; justify-content:flex-end; gap:4px; margin-top:4px; }
.chat-time  { font-size:10px; opacity:.65; }
.msg-ticks svg { width:13px; height:13px; stroke:rgba(255,255,255,.55); }

/* Imagen / archivo en burbuja */
.msg-imagen {
    max-width:220px; max-height:180px;
    border-radius:10px; display:block; cursor:pointer;
    transition:opacity .15s;
}
.msg-imagen:hover { opacity:.88; }
.msg-archivo {
    display:flex; align-items:center; gap:8px;
    padding:8px 12px; background:rgba(255,255,255,.08);
    border-radius:8px; font-size:12px; color:var(--text); text-decoration:none;
}
.msg-archivo:hover { background:rgba(255,255,255,.14); }

/* ============================================================
   TYPING INDICATOR
   ============================================================ */
.typing-indicator {
    display:none; align-items:center; gap:8px;
    padding:4px 24px 2px;
    font-size:12px; color:var(--muted); font-style:italic;
    flex-shrink:0;
}
.typing-indicator.visible { display:flex; }
.typing-dots { display:flex; gap:3px; align-items:center; }
.typing-dots span {
    width:5px; height:5px; background:var(--muted); border-radius:50%;
    animation:typingBounce .8s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay:.15s; }
.typing-dots span:nth-child(3) { animation-delay:.3s; }
@keyframes typingBounce {
    0%,100% { transform:translateY(0); opacity:.4; }
    50%     { transform:translateY(-5px); opacity:1; }
}

/* ============================================================
   EMOJI PICKER (emoji-picker-element, posición fija)
   ============================================================ */
emoji-picker.emoji-panel-float {
    position: fixed;
    bottom: 70px;
    right: 16px;
    width: min(380px, 98vw);
    z-index: 9000;
    display: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,.65);

    /* Tema oscuro */
    --background: #0d1520;
    --border-color: #1e2d3d;
    --indicator-color: var(--ql-primario);
    --input-border-color: #1e2d3d;
    --input-font-color: var(--text);
    --input-placeholder-color: #4b6272;
    --category-font-color: #64748b;
    --button-hover-background: #1e2d3d;
    --emoji-size: 1.6rem;
    --emoji-padding: 5px;
    --num-columns: 8;
}
emoji-picker.emoji-panel-float[style*="block"] { display: block; }

@media (max-width: 768px) {
    emoji-picker.emoji-panel-float {
        bottom: 66px;
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 14px 14px 0 0;
        --num-columns: 7;
    }
}

/* Wrapper centrado para cards en el chat */
.card-msg-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 4px 0;
}

/* ============================================================
   TARJETA DE ACUERDO (cliente — tema oscuro)
   ============================================================ */
.acuerdo-card {
    background: linear-gradient(135deg, #0a1929 0%, #0d2237 100%);
    border: 1px solid rgb(var(--ql-primario-rgb) / .35);
    border-radius: 16px;
    overflow: hidden;
    max-width: 320px;
    width: 100%;
    margin: 8px auto;
    box-shadow: 0 6px 24px rgba(0,0,0,.4), 0 0 0 1px rgb(var(--ql-primario-rgb) / .1);
}
.acuerdo-card-header {
    background: rgb(var(--ql-primario-rgb) / .14);
    border-bottom: 1px solid rgb(var(--ql-primario-rgb) / .2);
    padding: 11px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ql-primario);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: .1px;
}
.acuerdo-card-header svg { width: 15px; height: 15px; flex-shrink: 0; }
.acuerdo-card-body { padding: 12px 16px; }
.acuerdo-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    font-size: 12px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.acuerdo-row:last-child { border-bottom: none; }
.acuerdo-row span:first-child {
    color: rgba(255,255,255,.4);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .4px;
    flex-shrink: 0;
    padding-top: 1px;
}
.acuerdo-row span:last-child {
    font-weight: 600;
    color: var(--text);
    text-align: right;
    font-size: 12px;
}
.acuerdo-card-footer {
    padding: 6px 16px 10px;
    font-size: 10px;
    color: rgba(255,255,255,.3);
    text-align: right;
}

/* Tarjeta de solicitud */
.solicitud-card {
    background: var(--card);
    border: 1px solid rgba(99,179,237,.3);
    border-radius: 18px;
    overflow: hidden;
    max-width: 380px;
    width: 100%;
    margin: 8px auto;
    box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.sol-header {
    background: linear-gradient(135deg, rgba(99,179,237,.2) 0%, rgba(59,130,246,.25) 100%);
    color: #93c5fd;
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: .1px;
    border-bottom: 1px solid rgba(99,179,237,.2);
}
.sol-header svg { width: 17px; height: 17px; flex-shrink: 0; }
.sol-estado {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 999px;
    flex-shrink: 0;
}
.sol-estado--pendiente  { background: rgba(251,191,36,.15); color: var(--st-amber, #fbbf24); }
.sol-estado--aceptado   { background: rgba(34,197,94,.15);  color: #22c55e; }
.sol-estado--rechazado  { background: rgba(239,68,68,.15);  color: var(--st-red, #f87171); }
.sol-body { padding: 18px 22px 12px; }
.sol-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    font-size: 13px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sol-row:last-child { border-bottom: none; }
.sol-row span:first-child {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    flex-shrink: 0;
    padding-top: 2px;
    min-width: 80px;
}
.sol-row span:last-child { font-weight: 600; color: var(--text); text-align: right; line-height: 1.45; }
.sol-acciones {
    display: flex;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.sol-btn {
    flex: 1; padding: 11px 0; border-radius: 10px;
    font-size: 14px; font-weight: 700; font-family: 'DM Sans', sans-serif;
    cursor: pointer; border: none; transition: filter .15s, transform .1s;
}
.sol-btn:hover  { filter: brightness(1.1); }
.sol-btn:active { transform: scale(.97); }
.sol-btn--aceptar  { background: #059669; color: var(--text); box-shadow: 0 4px 12px rgba(5,150,105,.3); }
.sol-btn--rechazar { background: transparent; color: var(--st-red, #f87171); border: 1.5px solid rgba(239,68,68,.4); }
.sol-footer { padding: 8px 22px 14px; font-size: 10px; color: var(--muted); text-align: right; }

/* ============================================================
   DISPONIBILIDAD NOTA (modal acuerdo)
   ============================================================ */
.disponibilidad-nota {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    margin-top: 4px;
    min-height: 24px;
}
.disponibilidad-nota.info { color: var(--muted); background: rgba(255,255,255,.04); }
.disponibilidad-nota.ok   { color: #22c55e; background: rgba(34,197,94,.1); }
.disponibilidad-nota.warn { color: #f59e0b; background: rgba(245,158,11,.1); }


/* Texto sobre fondos de marca: siempre blanco (día y noche) */
html[data-theme="light"] :is(.sidebar-nav a.active, .nav-badge, .sidebar-avatar-big, .btn-modal-success, .sol-btn--aceptar, .btn-enviar, .btn-modal-primary) { color: #fff; }
html[data-theme="light"] .sidebar-nav a.active .nav-badge { background: #fff; color: var(--primary); }

/* Reportar usuario / mensaje */
.btn-reportar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    background: transparent;
    border: 1px solid rgba(127, 127, 127, .3);
    color: var(--muted);
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-reportar:hover { background: rgba(239, 68, 68, .12); color: #ef4444; border-color: rgba(239, 68, 68, .4); }
.btn-reportar svg { width: 16px; height: 16px; }
.msg-report {
    background: none; border: none; padding: 0 2px; cursor: pointer;
    color: inherit; opacity: .35; line-height: 0;
}
.msg-report:hover, .msg-report:focus-visible { opacity: 1; color: #ef4444; }
.msg-report svg { width: 12px; height: 12px; }

/* Colores de estado en modo claro: los tonos claros (#4ade80, #f87171…) están
   pensados para fondo oscuro y sobre blanco no se leen. */
html[data-theme="light"] {
    --st-green: #15803d; --st-red: #b91c1c; --st-orange: #c2410c;
    --st-blue: #1d4ed8; --st-amber: #b45309; --st-purple: #6d28d9;
}

/* Botón secundario (ej. "Reintentar" cuando no cargan las conversaciones):
   no tenía estilos y se veía como botón nativo del navegador. */
.btn-secundario {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 10px; padding: 8px 16px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--card-2, var(--card));
    color: var(--text); font-family: inherit; font-weight: 600; cursor: pointer;
}
.btn-secundario:hover { border-color: var(--primary); color: var(--primary); }
