/* =========================================
   Dealer Messages — Refactored
========================================= */

.dealer-messages-app{
    --dm-primary:#c8102e;
    --dm-primary-hover:#a90d27;
    --dm-text:#1f2937;
    --dm-heading:#111827;
    --dm-muted:#6b7280;
    --dm-light:#9ca3af;
    --dm-border:#e5e7eb;
    --dm-field-border:#d8dce3;
    --dm-surface:#fff;
    --dm-surface-soft:#f8fafc;
    --dm-radius:11px;

    width:100%;
    max-width:1380px;
    margin:35px auto;
    padding:0 20px;
    direction:rtl;
    color:var(--dm-text);
}

.dealer-messages-app,
.dealer-messages-app *{
    box-sizing:border-box;
}

/* Header */

.dealer-messages-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:24px;
    margin-bottom:24px;
}

.dealer-messages-title h2{
    margin:0 0 7px;
    color:var(--dm-heading);
    font-size:27px;
    font-weight:800;
}

.dealer-messages-title p{
    margin:0;
    color:var(--dm-muted);
    font-size:14px;
    line-height:1.8;
}

/* Buttons */

.dealer-message-primary-button,
.dealer-message-secondary-button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:var(--dm-radius);
    font-size:14px;
    font-weight:700;
    cursor:pointer;
}

.dealer-message-primary-button{
    min-height:46px;
    padding:10px 20px;
    border:0;
    background:var(--dm-primary);
    color:#fff;
    transition:transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.dealer-message-primary-button:hover{
    transform:translateY(-1px);
    box-shadow:0 8px 20px rgba(200,16,46,.2);
}

.dealer-message-primary-button:disabled{
    opacity:.55;
    cursor:not-allowed;
    transform:none;
    box-shadow:none;
}

.dealer-message-secondary-button{
    min-height:44px;
    padding:9px 18px;
    border:1px solid #d1d5db;
    background:#fff;
    color:#374151;
}

/* Stats */

.dealer-message-stats{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:16px;
    margin-bottom:22px;
}

.dealer-message-stat-card{
    position:relative;
    min-height:105px;
    padding:20px;
    overflow:hidden;
    border:1px solid var(--dm-border);
    border-radius:15px;
    background:#fff;
    box-shadow:0 7px 22px rgba(15,23,42,.045);
}

.dealer-message-stat-card::before{
    content:"";
    position:absolute;
    inset:0 auto 0 0;
    width:4px;
    background:var(--dm-primary);
}

.dealer-message-stat-label{
    display:block;
    margin-bottom:8px;
    color:var(--dm-muted);
    font-size:13px;
    font-weight:600;
}

.dealer-message-stat-card strong{
    display:block;
    color:var(--dm-heading);
    font-size:27px;
    font-weight:800;
}

/* Tabs */

.dealer-message-tabs{
    display:flex;
    align-items:center;
    gap:28px;
    padding:0 4px;
    border-bottom:1px solid var(--dm-border);
}

.dealer-message-tab{
    position:relative;
    display:flex;
    align-items:center;
    gap:8px;
    min-height:52px;
    padding:0 3px;
    border:0;
    background:transparent;
    color:var(--dm-muted);
    font-size:15px;
    font-weight:700;
    cursor:pointer;
}

.dealer-message-tab::after{
    content:"";
    position:absolute;
    right:0;
    bottom:-1px;
    width:0;
    height:3px;
    border-radius:3px 3px 0 0;
    background:var(--dm-primary);
    transition:width .2s ease;
}

.dealer-message-tab.active{
    color:var(--dm-primary);
}

.dealer-message-tab.active::after{
    width:100%;
}

.dealer-message-badge{
    min-width:22px;
    height:22px;
    padding:0 6px;
    border-radius:999px;
    background:var(--dm-primary);
    color:#fff;
    font-size:11px;
    line-height:22px;
    text-align:center;
}

/* Fields and toolbar */

.dealer-message-toolbar{
    display:grid;
    grid-template-columns:minmax(0,1fr) 230px;
    gap:12px;
    margin:18px 0;
}

.dealer-message-search input,
.dealer-message-filters select,
.dealer-message-field input[type="text"],
.dealer-message-field select,
.dealer-message-field textarea,
#dealer-reply-message{
    width:100%;
    margin:0;
    border:1px solid var(--dm-field-border);
    border-radius:var(--dm-radius);
    background:#fff;
    color:var(--dm-text);
    font-size:14px;
    outline:none;
}

.dealer-message-search input,
.dealer-message-filters select,
.dealer-message-field input[type="text"],
.dealer-message-field select{
    min-height:46px;
    padding:10px 14px;
}

.dealer-message-search input:focus,
.dealer-message-filters select:focus,
.dealer-message-field input[type="text"]:focus,
.dealer-message-field select:focus,
.dealer-message-field textarea:focus,
#dealer-reply-message:focus{
    border-color:var(--dm-primary);
    box-shadow:0 0 0 4px rgba(200,16,46,.08);
}

.dealer-message-field,
.dealer-message-attachments-field{
    position:relative;
    width:100%;
    margin-bottom:16px;
}

.dealer-message-field label,
.dealer-message-attachments-field label{
    display:block;
    margin-bottom:7px;
    color:#374151;
    font-size:13px;
    font-weight:700;
}

.dealer-message-field small,
.dealer-message-attachments-field small{
    display:block;
    margin-top:7px;
    color:var(--dm-light);
    font-size:11px;
}

.dealer-message-field textarea{
    min-height:135px;
    padding:10px 13px;
    resize:vertical;
}

/* Select compatibility */

.dealer-messages-app select,
.dealer-message-modal select{
    display:block !important;
    width:100% !important;
    min-height:48px !important;
    margin:0 !important;
    padding:10px 14px !important;
    direction:rtl !important;
    text-align:right !important;
    text-align-last:right !important;
    border:1px solid var(--dm-field-border) !important;
    border-radius:10px !important;
    background-color:#fff !important;
    background-image:none !important;
    color:var(--dm-text) !important;
    font-family:inherit !important;
    font-size:14px !important;
    line-height:1.8 !important;
    appearance:auto !important;
    -webkit-appearance:menulist !important;
    -moz-appearance:menulist !important;
    box-shadow:none !important;
}

.dealer-messages-app select option,
.dealer-message-modal select option{
    direction:rtl !important;
    text-align:right !important;
    padding:10px 12px !important;
    background:#fff !important;
    color:var(--dm-text) !important;
    font-family:inherit !important;
    font-size:14px !important;
    line-height:2 !important;
    white-space:normal !important;
}

.dealer-message-field .select2-container,
.dealer-message-field .wd-select,
.dealer-message-field .select-wrapper{
    width:100% !important;
}

.dealer-message-field .select-wrapper::before,
.dealer-message-field .select-wrapper::after,
.dealer-message-field .wd-select::before,
.dealer-message-field .wd-select::after{
    display:none !important;
    content:none !important;
}

/* Main layout */

.dealer-message-layout{
    display:grid;
    grid-template-columns:365px minmax(0,1fr);
    min-height:650px;
    overflow:hidden;
    border:1px solid var(--dm-border);
    border-radius:17px;
    background:#fff;
    box-shadow:0 14px 38px rgba(15,23,42,.06);
}

/* Conversation list */

.dealer-conversation-list-panel{
    border-left:1px solid var(--dm-border);
    background:#fafafa;
}

.dealer-conversation-list{
    height:650px;
    overflow-y:auto;
}

.dealer-conversation-item{
    position:relative;
    padding:17px 18px;
    border-bottom:1px solid #e8eaee;
    background:#fff;
    cursor:pointer;
    transition:background .2s ease;
}

.dealer-conversation-item:hover{
    background:#f9fafb;
}

.dealer-conversation-item.active{
    background:#fff5f6;
}

.dealer-conversation-item.active::before{
    content:"";
    position:absolute;
    inset:0 0 0 auto;
    width:4px;
    background:var(--dm-primary);
}

.dealer-conversation-item.unread{
    background:#fffafa;
}

.dealer-conversation-item-title{
    margin:0 0 6px;
    color:var(--dm-heading);
    font-size:14px;
    font-weight:800;
    line-height:1.7;
}

.dealer-conversation-item-preview{
    margin:0 0 10px;
    overflow:hidden;
    color:var(--dm-muted);
    font-size:13px;
    line-height:1.7;
    white-space:nowrap;
    text-overflow:ellipsis;
}

.dealer-conversation-item-meta{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    color:var(--dm-light);
    font-size:11px;
}

.dealer-conversation-item-details{
    display:flex !important;
    align-items:center;
    flex-wrap:wrap;
    gap:7px !important;
    margin:10px 0;
}

.dealer-conversation-item-details > span{
    display:inline-flex !important;
    margin:0 !important;
}

.dealer-conversation-status,
.dealer-conversation-category{
    align-items:center;
    justify-content:center;
    min-height:26px;
    padding:3px 10px;
    border-radius:999px;
    font-size:11px;
    font-weight:700;
    line-height:1.4;
    white-space:nowrap;
}

.dealer-conversation-category,
.dealer-conversation-status.status-closed{
    border:1px solid #d1d5db;
    background:#f3f4f6;
    color:#6b7280;
}

.dealer-conversation-status.status-open{
    border:1px solid #a7f3d0;
    background:#ecfdf5;
    color:#047857;
}

.dealer-conversation-status.status-waiting_admin{
    border:1px solid #fed7aa;
    background:#fff7ed;
    color:#c2410c;
}

.dealer-conversation-status.status-waiting_dealer{
    border:1px solid #bfdbfe;
    background:#eff6ff;
    color:#1d4ed8;
}

/* Conversation view */

.dealer-conversation-view-panel{
    min-width:0;
    background:#fff;
}

.dealer-message-empty-state{
    display:flex;
    min-height:650px;
    padding:30px;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    text-align:center;
}

.dealer-message-empty-state h3{
    margin:0 0 10px;
    color:var(--dm-heading);
    font-size:21px;
}

.dealer-message-empty-state p{
    margin:0;
    color:var(--dm-muted);
    font-size:14px;
}

.dealer-conversation-header{
    padding:20px 24px;
    border-bottom:1px solid var(--dm-border);
}

.dealer-conversation-ticket{
    display:inline-block;
    margin-bottom:6px;
    direction:ltr;
    color:var(--dm-light);
    font-size:12px;
    font-weight:700;
}

.dealer-conversation-header h3{
    margin:0 0 10px;
    color:var(--dm-heading);
    font-size:19px;
    font-weight:800;
}

.dealer-conversation-meta{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.dealer-conversation-meta span{
    display:inline-flex;
    align-items:center;
    min-height:26px;
    padding:3px 9px;
    border-radius:999px;
    background:#f3f4f6;
    color:#4b5563;
    font-size:11px;
    font-weight:700;
}

/* Chat */

.dealer-conversation-messages{
    min-height:360px;
    max-height:430px;
    padding:24px;
    overflow-y:auto;
    background:var(--dm-surface-soft);
}

.dealer-chat-message{
    display:flex;
    margin-bottom:18px;
}

.dealer-chat-message.dealer{
    justify-content:flex-start;
}

.dealer-chat-message.admin{
    justify-content:flex-end;
}

.dealer-chat-bubble{
    width:fit-content;
    max-width:72%;
    padding:13px 15px;
    border-radius:15px;
    box-shadow:0 4px 12px rgba(15,23,42,.05);
}

.dealer-chat-message.dealer .dealer-chat-bubble{
    border:1px solid var(--dm-border);
    border-top-right-radius:4px;
    background:#fff;
}

.dealer-chat-message.admin .dealer-chat-bubble{
    border:1px solid #ffd7de;
    border-top-left-radius:4px;
    background:#fff0f2;
}

.dealer-chat-sender{
    display:block;
    margin-bottom:5px;
    color:#374151;
    font-size:12px;
    font-weight:800;
}

.dealer-chat-text{
    color:var(--dm-text);
    font-size:14px;
    line-height:1.9;
    white-space:pre-wrap;
    word-break:break-word;
}

.dealer-chat-time{
    display:block;
    margin-top:7px;
    color:var(--dm-light);
    font-size:10px;
}

/* Sent attachments */

.dealer-chat-attachments{
    display:flex !important;
    width:100% !important;
    margin-top:12px !important;
    flex-direction:column !important;
    gap:8px !important;
}

.dealer-chat-text + .dealer-chat-attachments{
    margin-top:14px !important;
}

.dealer-chat-attachment{
    display:flex !important;
    width:100% !important;
    min-height:46px !important;
    padding:10px 12px !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:12px !important;
    overflow:hidden !important;
    border:1px solid #e2e8f0 !important;
    border-radius:10px !important;
    background:#fff !important;
    color:#334155 !important;
    text-decoration:none !important;
    box-shadow:none !important;
    transition:border-color .2s ease, background .2s ease !important;
}

.dealer-chat-attachment:hover{
    border-color:var(--dm-primary) !important;
    background:#fff7f7 !important;
    color:var(--dm-primary) !important;
    text-decoration:none !important;
}

.dealer-chat-attachment::before{
    content:"\f316";
    display:flex;
    width:32px;
    height:32px;
    flex:0 0 32px;
    align-items:center;
    justify-content:center;
    border-radius:8px;
    background:#f1f5f9;
    color:#475569;
    font-family:dashicons;
    font-size:18px;
    line-height:1;
}

.dealer-chat-attachment-name{
    display:block !important;
    min-width:0 !important;
    flex:1 1 auto !important;
    overflow:hidden !important;
    color:inherit !important;
    font-size:12px !important;
    font-weight:700 !important;
    line-height:1.6 !important;
    white-space:nowrap !important;
    text-overflow:ellipsis !important;
}

.dealer-chat-attachment-size{
    display:block !important;
    flex:0 0 auto !important;
    direction:ltr !important;
    unicode-bidi:isolate !important;
    color:#94a3b8 !important;
    font-size:10px !important;
    font-weight:400 !important;
    white-space:nowrap !important;
}

.dealer-chat-bubble .dealer-chat-attachment span{
    margin:0 !important;
    padding:0 !important;
}

/* Reply */

.dealer-reply-section{
    padding:20px 24px;
    border-top:1px solid var(--dm-border);
    background:#fff;
}

#dealer-reply-message{
    display:block;
    min-height:110px;
    margin-bottom:14px;
    padding:13px 15px;
    resize:vertical;
    line-height:1.8;
}

/* Selected files before send */

.dealer-selected-files{
    display:flex;
    flex-direction:column;
    gap:6px;
    margin-top:8px;
}

#dealer-new-conversation-modal .dealer-selected-file,
#dealer-reply-section .dealer-selected-file{
    display:flex !important;
    width:100% !important;
    min-height:0 !important;
    height:38px !important;
    margin:0 !important;
    padding:5px 8px !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:8px !important;
    border:1px solid #e2e8f0 !important;
    border-radius:7px !important;
    background:#f8fafc !important;
}

#dealer-new-conversation-modal .dealer-selected-file.invalid,
#dealer-reply-section .dealer-selected-file.invalid{
    border-color:#fecaca !important;
    background:#fef2f2 !important;
}

#dealer-new-conversation-modal .dealer-selected-file-info,
#dealer-reply-section .dealer-selected-file-info{
    display:flex !important;
    min-width:0 !important;
    flex:1 1 auto !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:8px !important;
}

#dealer-new-conversation-modal .dealer-selected-file-name,
#dealer-reply-section .dealer-selected-file-name{
    display:block !important;
    min-width:0 !important;
    flex:1 1 auto !important;
    margin:0 !important;
    padding:0 !important;
    overflow:hidden !important;
    color:#334155 !important;
    font-size:11px !important;
    font-weight:600 !important;
    line-height:1.4 !important;
    white-space:nowrap !important;
    text-overflow:ellipsis !important;
}

#dealer-new-conversation-modal .dealer-selected-file-size,
#dealer-reply-section .dealer-selected-file-size{
    display:block !important;
    flex:0 0 auto !important;
    margin:0 !important;
    padding:0 !important;
    direction:ltr !important;
    color:#94a3b8 !important;
    font-size:10px !important;
    line-height:1 !important;
    white-space:nowrap !important;
}

#dealer-new-conversation-modal .dealer-remove-selected-file,
#dealer-reply-section .dealer-remove-selected-file{
    display:flex !important;
    width:22px !important;
    min-width:22px !important;
    height:22px !important;
    min-height:22px !important;
    flex:0 0 22px !important;
    margin:0 !important;
    padding:0 !important;
    align-items:center !important;
    justify-content:center !important;
    border:0 !important;
    border-radius:5px !important;
    background:#f1f5f9 !important;
    color:#64748b !important;
    font-size:15px !important;
    line-height:1 !important;
    cursor:pointer !important;
}

#dealer-new-conversation-modal .dealer-remove-selected-file:hover,
#dealer-reply-section .dealer-remove-selected-file:hover{
    background:#fee2e2 !important;
    color:#dc2626 !important;
}

/* Alerts */

.dealer-message-empty{
    padding:35px 20px;
    color:var(--dm-light);
    font-size:13px;
    text-align:center;
}

.dealer-message-alert{
    max-width:900px;
    margin:30px auto;
    padding:14px 16px;
    border-radius:10px;
    text-align:center;
}

.dealer-message-alert-error,
.dealer-message-form-error,
.dealer-message-file-error{
    border:1px solid #fecaca;
    background:#fef2f2;
    color:#991b1b;
}

.dealer-message-form-error,
.dealer-message-file-error,
.dealer-message-form-success{
    padding:10px 12px;
    border-radius:9px;
}

.dealer-message-form-success{
    border:1px solid #bbf7d0;
    background:#f0fdf4;
    color:#166534;
}

/* Modal */

body.dealer-message-modal-open{
    overflow:hidden;
}

.dealer-message-modal{
    position:fixed;
    z-index:999999;
    inset:0;
    display:flex;
    padding:20px;
    align-items:center;
    justify-content:center;
}

.dealer-message-modal-backdrop{
    position:absolute;
    inset:0;
    background:rgba(17,24,39,.52);
    backdrop-filter:blur(3px);
}

.dealer-message-modal-content{
    position:relative;
    z-index:2;
    width:100%;
    max-width:610px;
    max-height:90vh;
    overflow-x:hidden !important;
    overflow-y:auto;
    border-radius:17px;
    background:#fff;
    box-shadow:0 25px 70px rgba(0,0,0,.22);
}

.dealer-message-modal-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:18px 22px;
    border-bottom:1px solid var(--dm-border);
}

.dealer-message-modal-header h3{
    margin:0;
    color:var(--dm-heading);
    font-size:18px;
}

.dealer-message-modal-close{
    width:36px;
    height:36px;
    padding:0;
    border:0;
    border-radius:9px;
    background:#f3f4f6;
    color:#4b5563;
    font-size:25px;
    line-height:34px;
    cursor:pointer;
}

.dealer-message-modal-body{
    padding:22px;
    overflow:visible !important;
}

.dealer-message-modal-footer{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:10px;
    padding:16px 22px;
    border-top:1px solid var(--dm-border);
}

.dealer-message-form-notice{
    font-size:13px;
    line-height:1.8;
}

/* Responsive */

@media (max-width:900px){

    .dealer-conversation-view{
        display:flex;
        flex-direction:column;
        width:100%;
        min-width:0;
    }

    .dealer-conversation-header,
    .dealer-conversation-messages,
    .dealer-reply-section{
        width:100%;
        min-width:0;
    }


    .dealer-message-stats{
        grid-template-columns:1fr;
    }

    .dealer-message-layout{
        grid-template-columns:1fr;
    }

    .dealer-conversation-list-panel{
        border-left:0;
        border-bottom:1px solid var(--dm-border);
    }

    .dealer-conversation-list{
        height:350px;
    }

    .dealer-message-empty-state{
        min-height:430px;
    }


    .dealer-conversation-view-panel{
    display:flex;
    flex-direction:column;
    min-height:0;
}

.dealer-conversation-header{
    padding:16px;
}

.dealer-conversation-messages{
    min-height:0;
    max-height:none;
    height:50vh;
    padding:16px;
}

.dealer-reply-section{
    padding:16px;
}

}

@media (max-width:650px){

        

    .dealer-messages-app{
        width:100%;
        max-width:none;
        margin:16px 0;
        padding:0 8px;
        overflow-x:hidden;
    }

    .dealer-message-layout{
        display:block !important;
        width:100% !important;
        min-width:0 !important;
        min-height:0 !important;
        overflow:visible !important;
    }

    .dealer-conversation-list-panel,
    .dealer-conversation-view-panel,
    .dealer-conversation-view{
        display:block;
        width:100% !important;
        min-width:0 !important;
        max-width:100% !important;
    }

    .dealer-conversation-list{
        width:100%;
        height:320px;
        overflow-y:auto;
        overflow-x:hidden;
    }

    .dealer-message-empty-state{
        width:100%;
        min-height:360px;
        padding:24px 16px;
        overflow:hidden;
    }

    .dealer-conversation-header{
        width:100%;
        padding:16px 14px;
        overflow:hidden;
    }

    .dealer-conversation-header h3{
        max-width:100%;
        overflow-wrap:anywhere;
        word-break:break-word;
    }

    .dealer-conversation-messages{
        width:100%;
        min-width:0;
        min-height:0;
        max-height:none;
        height:auto;
        padding:14px 10px;
        overflow-x:hidden;
        overflow-y:visible;
    }

    .dealer-chat-message{
        width:100%;
        min-width:0;
    }

    .dealer-chat-bubble{
        width:auto;
        max-width:100% !important;
        min-width:0;
    }

    .dealer-chat-text{
        max-width:100%;
        overflow-wrap:anywhere;
        word-break:break-word;
    }

    .dealer-chat-attachments{
        min-width:0;
    }

    .dealer-chat-attachment{
        width:100% !important;
        min-width:0 !important;
    }

    .dealer-chat-attachment-name{
        max-width:100% !important;
        white-space:normal !important;
        overflow-wrap:anywhere !important;
        word-break:break-word !important;
    }

    .dealer-reply-section{
        width:100%;
        min-width:0;
        padding:16px 12px;
    }


 .dealer-messages-panel-header{
        padding:17px 15px;
        border-radius:13px;
    }

    .dealer-messages-panel-heading h2{
        font-size:20px;
    }

    .dealer-messages-panel-heading p{
        font-size:12px;
    }

    .dealer-messages-panel-actions{
        display:grid;
        grid-template-columns:1fr;
        margin-top:13px;
    }

    .dealer-message-header-button{
        width:100% !important;
        min-height:40px !important;
    }

    .dealer-message-header-new{
        order:-1;
    }


}
    



.dealer-messages-panel-header{
    display:block;
    margin-bottom:24px;
    padding:18px 22px;
    border-radius:17px;
    background:linear-gradient(135deg,#1e293b,#0f172a);
    color:#fff;
    box-shadow:0 14px 38px rgba(15,23,42,.12);
}

.dealer-messages-panel-heading{
    width:100%;
    min-width:0;
}

.dealer-messages-panel-heading h2{
    margin:0 0 5px;
    color:#fff;
    font-size:22px;
    font-weight:800;
    line-height:1.5;
}

.dealer-messages-panel-heading p{
    margin:0;
    color:rgba(255,255,255,.82);
    font-size:13px;
    line-height:1.8;
}

.dealer-messages-panel-actions{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:8px;
    margin-top:14px;
}

.dealer-message-header-button{
    display:inline-flex !important;
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    min-height:36px !important;
    padding:6px 14px !important;
    align-items:center;
    justify-content:center;
    border-radius:9px;
    font-size:13px !important;
    font-weight:700;
    line-height:1.5;
    white-space:nowrap;
    text-decoration:none;
    cursor:pointer;
    box-shadow:none !important;
    transform:none !important;
}

.dealer-message-header-back{
    border:1px solid rgba(255,255,255,.28);
    background:rgba(255,255,255,.06);
    color:#fff;
}

.dealer-message-header-back:hover{
    border-color:rgba(255,255,255,.45);
    background:rgba(255,255,255,.13);
    color:#fff;
}

.dealer-message-header-new{
    padding-right:18px !important;
    padding-left:18px !important;
    border:0 !important;
    background:#c8102e !important;
    color:#fff !important;
}

.dealer-message-header-new:hover{
    background:#a90d27 !important;
    color:#fff !important;
}







    .dealer-messages-app{
        margin:20px auto;
        padding:0 12px;
    }

    .dealer-messages-header{
        align-items:stretch;
        flex-direction:column;
    }

    .dealer-message-toolbar{
        grid-template-columns:1fr;
    }

    .dealer-message-tabs{
        gap:18px;
    }

    .dealer-message-tab{
        font-size:13px;
    }

    .dealer-message-layout{
        border-radius:12px;
    }

    .dealer-chat-bubble{
        max-width:90%;
    }

    

    .dealer-chat-attachments{
        gap:6px !important;
    }

    .dealer-chat-attachment{
        display:grid !important;
        grid-template-columns:32px minmax(0, 1fr) !important;
        grid-template-rows:auto auto !important;
        column-gap:9px !important;
        row-gap:1px !important;

        width:100% !important;
        min-height:54px !important;
        height:auto !important;
        padding:7px 9px !important;

        align-items:center !important;
        border-radius:9px !important;
    }

    .dealer-chat-attachment::before{
        grid-column:1 !important;
        grid-row:1 / span 2 !important;

        width:32px !important;
        height:32px !important;
        min-width:32px !important;
        flex:none !important;

        font-size:17px !important;
        border-radius:7px !important;
    }

    .dealer-chat-attachment-name{
        grid-column:2 !important;
        grid-row:1 !important;

        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;

        font-size:11px !important;
        line-height:1.5 !important;
        white-space:nowrap !important;
        overflow:hidden !important;
        text-overflow:ellipsis !important;
    }

    .dealer-chat-attachment-size{
        grid-column:2 !important;
        grid-row:2 !important;

        width:auto !important;
        margin:0 !important;
        padding:0 !important;

        font-size:9px !important;
        line-height:1.3 !important;
        text-align:right !important;
    }
   
.dealer-chat-attachments{
    margin-bottom:12px !important;
}
    
.dealer-chat-attachment-name{
    text-align:right;
}

    .dealer-message-modal{
        padding:10px;
    }

    .dealer-message-modal-content{
        border-radius:13px;
    }

    .dealer-message-modal-footer{
        flex-direction:column-reverse;
    }

    .dealer-message-modal-footer button{
        width:100%;
    }



    .dealer-conversation-header h3{
    font-size:16px;
    line-height:1.8;
}

.dealer-conversation-meta{
    gap:6px;
}

.dealer-chat-bubble{
    max-width:100%;
}

.dealer-chat-text{
    font-size:13px;
}

.dealer-conversation-messages{
    height:45vh;
}



.dealer-file-picker{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:10px;
}

.dealer-file-input{
    position:absolute !important;
    width:1px !important;
    height:1px !important;
    padding:0 !important;
    margin:-1px !important;
    overflow:hidden !important;
    clip:rect(0, 0, 0, 0) !important;
    white-space:nowrap !important;
    border:0 !important;
}

.dealer-file-picker-button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:7px;

    min-height:38px;
    padding:7px 13px;

    border:1px solid #d8dce3;
    border-radius:8px;

    background:#fff;
    color:#374151;

    font-family:inherit;
    font-size:12px;
    font-weight:700;

    cursor:pointer;
    transition:
        border-color .2s ease,
        background .2s ease,
        color .2s ease;
}

.dealer-file-picker-button:hover{
    border-color:#c8102e;
    background:#fff7f7;
    color:#c8102e;
}

.dealer-file-picker-button .dashicons{
    width:17px;
    height:17px;
    font-size:17px;
}

.dealer-file-picker-hint{
    color:#94a3b8;
    font-size:11px;
}



/* =========================================
   Desktop layout corrections
========================================= */

@media (min-width:901px){

    .dealer-messages-app{
        max-width:1380px;
        margin:35px auto;
        padding:0 20px;
    }

    /* سربرگ */
    .dealer-messages-header{
        display:flex !important;
        align-items:center !important;
        justify-content:space-between !important;
        flex-direction:row !important;
        gap:24px !important;
    }

    .dealer-messages-title{
        min-width:0;
        flex:1 1 auto;
    }

   

    #dealer-new-conversation:hover{
        background:#a90d27 !important;
        color:#fff !important;
    }

    /* کارت‌های آمار */
    .dealer-message-stats{
        grid-template-columns:repeat(3,minmax(0,1fr)) !important;
        gap:16px !important;
    }

    /* تب‌ها */
    .dealer-message-tabs{
        justify-content:flex-start;
    }

    /* جستجو و فیلتر */
    .dealer-message-toolbar{
        display:grid !important;
        grid-template-columns:minmax(0,1fr) 230px !important;
        align-items:start;
        gap:12px !important;
    }

    .dealer-message-search,
    .dealer-message-filters{
        width:100%;
        min-width:0;
    }

    /* بدنه اصلی */
    .dealer-message-layout{
        display:grid !important;
        grid-template-columns:365px minmax(0,1fr) !important;
        width:100% !important;
        min-height:650px !important;
        overflow:hidden !important;
    }

    .dealer-conversation-list-panel{
        width:auto !important;
        min-width:0 !important;
        max-width:none !important;
    }

    .dealer-conversation-view-panel,
    .dealer-conversation-view{
        width:100% !important;
        min-width:0 !important;
        max-width:100% !important;
    }
}

@media (max-width:650px){

    .dealer-messages-panel-actions{
        display:flex !important;
        flex-direction:column !important;
        align-items:stretch !important;
        width:100% !important;
        gap:10px !important;
    }

    .dealer-message-header-button,
    .dealer-message-header-new,
    .dealer-message-header-back{
        display:flex !important;
        width:100% !important;
        justify-content:center !important;
    }

}

.dealer-message-header-new{

    border-radius:10px !important;
    overflow:hidden !important;
    appearance:none;
    -webkit-appearance:none;

}