/* PrimeDesk Admin Styles */

:root {
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;
}

.primedesk-wrap {
    padding: var(--sp-3) 0 0 0;
    max-height: 100vh;
    overflow: hidden;
}

.primedesk-wrap .primedesk-layout {
    margin: 0;
}

.primedesk-layout {
    display: flex;
    height: calc(100vh - 120px);
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin: var(--sp-3) 0 0 0;
    min-width: 0; /* Prevent flex overflow */
}

/* Conversations Panel */
.conversations-panel {
    flex: 0 0 320px;
    min-width: 280px;
    max-width: 35%;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    overflow: hidden; /* Prevent content overflow */
}

.conversations-header {
    padding: var(--sp-4) var(--sp-4);
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.conversations-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversations-controls {
    display: flex;
    gap: var(--sp-2);
    flex-shrink: 0; /* Prevent controls from shrinking */
}

.conversations-controls .button {
    padding: var(--sp-1) var(--sp-2);
    font-size: 12px;
    height: auto;
    line-height: 1.4;
}

.conversation-overview {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-wrap: wrap;
}

.overview-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    background: #f3f4f6;
    border-radius: 999px;
    padding: var(--sp-2) var(--sp-3);
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.overview-chip .chip-count {
    color: #111827;
}

.conversation-filter-bar {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    position: relative;
}

.filter-search-row {
    margin-bottom: 0;
}

.filter-search-row .search-group {
    width: 100%;
}

.conversation-filter-bar input[type="search"] {
    width: 100% !important;
    box-sizing: border-box;
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.filter-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    white-space: nowrap;
}

.conversation-filter-bar .filter-controls {
    margin: 0;
}

.conversation-status-tabs {
    display: flex;
    gap: var(--sp-1);
    flex-wrap: wrap;
    padding: var(--sp-1);
    border-radius: 8px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.conversation-status-tab {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    padding: var(--sp-1) var(--sp-3);
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.conversation-status-tab:hover {
    background: #fff;
    color: #374151;
}

.conversation-status-tab .tab-count {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    padding: 0 var(--sp-2);
    font-weight: 700;
    color: inherit;
    font-size: 10px;
}

.conversation-status-tab.is-active {
    background: #fff;
    border-color: #e5e7eb;
    color: #111827;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.conversation-status-tab.is-active .tab-count {
    background: #111827;
    color: #fff;
}

/* Export section */
.export-section {
    border-top: 1px solid #e5e7eb;
    padding-top: var(--sp-2);
}

.export-expired-form {
    display: flex;
}

.export-controls {
    display: flex;
    gap: var(--sp-1);
    align-items: center;
    flex-wrap: wrap;
}

.export-controls input[type="date"] {
    padding: var(--sp-1) var(--sp-2);
    font-size: 11px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    max-width: 130px;
}

.export-expired-btn {
    display: inline-flex !important;
    align-items: center;
    gap: var(--sp-1);
    font-size: 11px !important;
    padding: var(--sp-1) var(--sp-3) !important;
    border-radius: 6px !important;
    border: 1px solid #e5e7eb !important;
    background: #f3f4f6 !important;
    color: #374151 !important;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
}

.export-expired-btn:hover {
    background: #fff !important;
    border-color: #d1d5db !important;
    color: #111827 !important;
}

.export-expired-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

.whatsapp-settings-section .category-manager {
    margin-top: var(--sp-3);
    border: 1px solid #e5e7eb;
    padding: var(--sp-3);
    border-radius: 8px;
    background: #fff;
}

.category-manager-table th,
.category-manager-table td {
    padding: var(--sp-2) var(--sp-2);
    vertical-align: top;
}

.category-manager-table input {
    width: 100%;
    box-sizing: border-box;
}

.category-manager-table td:nth-child(4) {
    width: 90px;
}

.category-color {
    width: 56px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    padding: 0;
    cursor: pointer;
}

.category-actions {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.category-manager-status {
    margin-top: var(--sp-3);
    min-height: 1.4em;
    font-size: 13px;
    font-weight: 600;
}

.category-manager-status.success {
    color: #047857;
}

.category-manager-status.error {
    color: #b91c1c;
}

.category-empty-row td {
    text-align: center;
    color: #6b7280;
}

.conversation-category-tabs {
    display: flex;
    gap: var(--sp-1);
    flex-wrap: wrap;
    padding: var(--sp-1);
    border-radius: 8px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.conversation-category-tab {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    padding: var(--sp-1) var(--sp-3);
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    flex: 0 1 auto;
    min-width: 0;
    justify-content: center;
}

.conversation-category-tab:hover {
    background: #fff;
    color: #374151;
}

.conversation-category-tab .tab-count {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    padding: 0 var(--sp-2);
    font-weight: 700;
    color: inherit;
    font-size: 10px;
}

.conversation-category-tab.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3);
}

.conversation-category-tab.is-active .tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Toast Notification */
.new-message-toast {
    position: fixed;
    top: var(--sp-6);
    right: var(--sp-6);
    min-width: 340px;
    max-width: 440px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-16px) translateX(var(--sp-2));
    transition: opacity 0.35s cubic-bezier(0.21, 1.02, 0.73, 1),
                transform 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
}

.new-message-toast.is-visible {
    opacity: 1;
    transform: translateY(0) translateX(0);
    pointer-events: auto;
}

.new-message-toast .toast-content {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-4);
    background: #1f2937;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2),
                0 2px 8px rgba(0, 0, 0, 0.12);
    border: none;
    overflow: hidden;
    position: relative;
}

.new-message-toast .toast-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    transform-origin: left;
}

.new-message-toast.is-visible .toast-content::after {
    animation: toast-progress 5s linear forwards;
}

@keyframes toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.new-message-toast.info .toast-content {
    background: #1f2937;
}

.new-message-toast.success .toast-content {
    background: #065f46;
}

.new-message-toast.error .toast-content {
    background: #7f1d1d;
}

.new-message-toast .toast-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #93c5fd;
}

.new-message-toast.success .toast-icon {
    color: #6ee7b7;
    background: rgba(110, 231, 183, 0.12);
}

.new-message-toast.error .toast-icon {
    color: #fca5a5;
    background: rgba(252, 165, 165, 0.12);
}

.new-message-toast .toast-icon svg {
    width: 18px;
    height: 18px;
}

.new-message-toast .toast-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: var(--sp-1);
}

.new-message-toast .toast-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #f9fafb;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.new-message-toast .toast-message {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.45;
    display: none;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.new-message-toast .toast-message.is-visible {
    display: -webkit-box;
}

.new-message-toast .toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    margin: 0 0 0 0;
}

.new-message-toast .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.new-message-toast .toast-close svg {
    width: 14px;
    height: 14px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .new-message-toast {
        top: var(--sp-4);
        right: var(--sp-4);
        left: var(--sp-4);
        min-width: auto;
        max-width: none;
    }

    .new-message-toast .toast-content {
        padding: var(--sp-3) var(--sp-4);
        gap: var(--sp-3);
    }

    .new-message-toast .toast-title {
        font-size: 13px;
    }

    .new-message-toast .toast-message {
        font-size: 12px;
    }
}

.filter-controls {
    display: flex;
    gap: var(--sp-2);
    align-items: stretch;
    min-width: 0;
}

.filter-group input[type="search"],
.filter-group select {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: var(--sp-2) var(--sp-3) var(--sp-2) 32px;
    font-size: 11px;
    background: #fff;
    color: #1f2937;
    transition: all 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}

.filter-group input[type="search"] {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%239ca3af" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.35-4.35"></path></svg>');
    background-repeat: no-repeat;
    background-position: var(--sp-3) center;
}

.filter-group input[type="search"]::placeholder {
    color: #9ca3af;
    font-size: 11px;
}

.filter-group select {
    padding: var(--sp-2) 28px var(--sp-2) var(--sp-3);
    font-size: 11px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%239ca3af" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right var(--sp-2) center;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.filter-group input[type="search"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.filter-group input[type="search"]:hover,
.filter-group select:hover {
    border-color: #d1d5db;
}

.search-group {
    flex: 1 1 auto;
    min-width: 0;
}


.search-group input[type="search"] {
    width: 100%;
}

.category-group {
    flex: 0 1 auto;
    min-width: 140px;
    max-width: 180px;
}

.category-group select {
    width: 100%;
    min-width: 0;
}

#conversations-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.conversation-item {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: #ffffff;
    min-width: 0;
}

.conversation-details {
    min-width: 0;
}

.conversation-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.conversation-item.active {
    background-color: #eff6ff;
}

.conversation-item.active::before {
    background: #3b82f6;
}

.conversation-item[data-status="new"]::before    { background: #0b5cab; }
.conversation-item[data-status="active"]::before { background: #1b5e20; }
.conversation-item[data-status="closed"]::before { background: #4a148c; }
.conversation-item[data-status="expired"]::before{ background: #bf360c; }

.conversation-item.conversation-reopened::before {
    background: #f59e0b;
}

.conversation-item.conversation-reopened.active::before {
    background: linear-gradient(to bottom, #f59e0b 0%, #3b82f6 100%);
}

.conversation-details {
    min-width: 0;
}

.conversation-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--sp-3);
    flex-wrap: nowrap;
}

.conversation-sender {
    font-weight: 600;
    font-size: 13.5px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
    overflow: hidden; /* Prevent overflow */
}

.conversation-sender-number {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-category-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--sp-1) var(--sp-3);
    border-radius: 6px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.01em;
}

.thread-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 var(--sp-2);
    border-radius: 6px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.conversation-activity-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 var(--sp-2);
    border-radius: 6px;
    background: #fef3c7;
    color: #92400e;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.thread-list {
    margin-top: var(--sp-2);
    padding: var(--sp-2) 0 0 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    border-top: 1px solid #e5e7eb;
    overflow-x: auto;
    scrollbar-width: none;
}

.thread-list::-webkit-scrollbar {
    display: none;
}

.thread-item-wrapper {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    position: relative;
}

.thread-item-wrapper .thread-item {
    flex: 1;
}

.thread-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 4px;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.thread-delete-btn:hover {
    background: #fecaca;
    border-color: #f87171;
    color: #b91c1c;
}


.thread-delete-btn.deleting {
    opacity: 0.5;
    pointer-events: none;
}

.thread-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    border: none;
    background: #f3f4f6;
    padding: var(--sp-2) var(--sp-3);
    border-radius: 8px;
    font-size: 0.78rem;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.thread-item.thread-main {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #94a3b8;
    padding: var(--sp-2) var(--sp-4);
    font-weight: 600;
}

.thread-item.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.thread-label {
    font-weight: 600;
}

.thread-preview {
    flex: 1;
    font-size: 0.74rem;
    color: rgba(15, 23, 42, 0.8);
}

.thread-time {
    font-size: 0.7rem;
    color: rgba(55, 65, 81, 0.8);
}

.thread-unread-badge,
.thread-activity-badge {
    font-size: 0.63rem;
    padding: 0 var(--sp-2);
    border-radius: 999px;
}

.thread-unread-badge {
    background: #dc2626;
    color: #fff;
}

.thread-activity-badge {
    background: #fde047;
    color: #92400e;
}

.thread-status-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    opacity: 0.85;
}

.thread-item.active .thread-status-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    opacity: 1;
}

/* Multi-level thread hierarchy styles */
.thread-category-group {
    display: contents;
}

.thread-category-group::before {
    content: none;
    opacity: 0.3;
}

.thread-item.thread-subtype {
    padding: var(--sp-1) var(--sp-3);
    font-size: 0.75rem;
    background: #f8fafc;
    border-left: 2px solid #cbd5e1;
    border-radius: 6px;
}

.thread-item.thread-subtype.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-left-color: #1e40af;
    box-shadow: 0 1px 6px rgba(37, 99, 235, 0.2);
}

.thread-item.thread-subtype .thread-label {
    font-weight: 500;
}

.thread-item:hover {
    background: #e5e7eb;
    transform: translateX(2px);
}

.thread-item.thread-main:hover {
    background: #f9fafb;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.thread-item.active:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.thread-item.thread-subtype:hover {
    background: #f1f5f9;
    border-left-color: #94a3b8;
}

.thread-item.thread-subtype.active:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.unread-badge {
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 0 var(--sp-2);
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

.conversation-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: 11px;
    color: #999;
    margin-top: var(--sp-1);
}

.conversation-time {
    font-size: inherit;
    color: inherit;
}

.conversation-actions {
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
    align-self: center;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.delete-conversation {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    border-radius: 4px;
}

.delete-conversation:hover {
    background: #dc3545;
    color: white;
}

.no-conversations {
    padding: var(--sp-10) var(--sp-5);
    text-align: center;
    color: #666;
}

/* Chat Panel */
.chat-panel {
    flex: 1 1 auto;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #ddd;
    overflow: hidden; /* Prevent content overflow */
}

.actions-panel {
    flex: 0 0 280px;
    min-width: 250px;
    max-width: 25%;
    display: flex;
    flex-direction: column;
    background: #fdfdfd;
    border-left: 1px solid #ddd;
    overflow: hidden; /* Prevent content overflow */
}

.is-hidden {
    display: none !important;
}

.actions-header {
    padding: var(--sp-4) var(--sp-4);
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.actions-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actions-context {
    margin: var(--sp-2) 0 0;
    font-size: 13px;
    color: #666;
    word-wrap: break-word;
}

.actions-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
    min-width: 0; /* Prevent flex overflow */
}

.actions-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #888;
    padding: var(--sp-5);
    border: 1px dashed #d0d7de;
    border-radius: 8px;
    background: #fdfdff;
}

.actions-placeholder .dashicons {
    font-size: 32px;
    margin-bottom: var(--sp-3);
    opacity: 0.4;
}

.actions-content {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.action-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.action-group h3 {
    margin: 0 0 var(--sp-2);
    font-size: 14px;
    color: #23282d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.action-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 0;
}

.status-controls,
.thread-status-controls {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    padding: var(--sp-1) var(--sp-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.conversation-sender-text {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex: 1;
    min-width: 0;
}

.conversation-sender-number {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-select-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #555;
}

.status-select {
    width: 100%;
    border-radius: 6px;
    border: 1px solid #d0d7de;
    padding: var(--sp-2) var(--sp-3);
    background: #fff;
    font-size: 13px;
    color: #23282d;
}

.status-select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.context-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding-bottom: var(--sp-1);
}

.context-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
}

.context-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9ca3af;
    flex-shrink: 0;
}

.thread-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-2);
}

.thread-status-header h3 {
    margin: 0;
}

.status-select-styled {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-3);
    background: #ffffff;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%236b7280" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right var(--sp-3) center;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.status-select-styled:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background-color: #fff;
}

.status-select-styled:disabled {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
    pointer-events: none;
}

.status-new {
    background: #e3f2fd;
    color: #0b5cab;
}

.status-active {
    background: #e8f5e9;
    color: #1b5e20;
}

.status-closed {
    background: #f3e5f5;
    color: #4a148c;
}

.status-expired {
    background: #fff3e0;
    color: #bf360c;
}

.assigned-member-display {
    padding: var(--sp-3) var(--sp-3);
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: var(--sp-3);
}

.assigned-member-info .no-assignment {
    color: #6b7280;
    font-size: 13px;
    font-style: italic;
}

.assigned-member-badge {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    color: #1e40af;
    font-weight: 500;
    font-size: 13px;
}

.assigned-member-badge .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #2563eb;
}

.assigned-member-badge .member-name {
    flex: 1;
}

.assignment-controls {
    margin-top: var(--sp-3);
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    flex-wrap: wrap;
}

.assignment-controls select {
    flex: 1;
    min-width: 0;
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    background-color: #ffffff;
    color: #374151;
    height: 36px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.assignment-controls select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.assignment-controls select:disabled {
    background-color: #f9fafb;
    cursor: not-allowed;
    color: #9ca3af;
}

.assignment-controls .button {
    flex-shrink: 0;
    padding: var(--sp-2) var(--sp-4);
    height: 36px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    border-radius: 8px;
    border: none;
    background: #667eea;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.assignment-controls .button:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.assignment-controls .button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.assignment-controls .button.compact {
    padding: 0;
    width: 36px;
    height: 36px;
}

.assignment-controls .button.is-loading .dashicons {
    animation: pd-spin 0.7s linear infinite;
    opacity: 0.7;
}

@keyframes pd-spin {
    to { transform: rotate(360deg); }
}

.assignment-helper {
    margin-top: var(--sp-2);
    font-size: 12px;
    color: #6b7280;
}

.collaboration-controls {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

#notify-agent-select {
    width: 100%;
}

.notes-history {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: var(--sp-4);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
    flex: 1;
    min-height: 180px;
}

.notes-history .no-notes {
    padding: var(--sp-5);
    text-align: center;
    color: #999;
    font-size: 13px;
    margin: 0;
}

.note-item {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.note-item:last-child {
    border-bottom: none;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-2);
}

.note-author {
    font-weight: 600;
    font-size: 12px;
    color: #2563eb;
}

.note-timestamp {
    font-size: 11px;
    color: #999;
}

.note-content {
    font-size: 13px;
    color: #23282d;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.add-note-section {
    margin-top: var(--sp-4);
}

.add-note-section textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: var(--sp-2) var(--sp-3);
    font-size: 13px;
    color: #23282d;
    background: #fff;
    font-family: inherit;
}

.add-note-section textarea:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    pointer-events: none;
}

.add-note-section textarea:not(:disabled) {
    pointer-events: auto;
    cursor: text;
}

.add-note-section textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.note-actions {
    margin-top: var(--sp-3);
    display: flex;
    justify-content: flex-end;
}

.notes-group .description {
    margin: var(--sp-2) 0 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.delete-thread-group {
    border-top: 1px solid #f0f0f0;
    padding-top: var(--sp-5);
}

.delete-thread-group .action-delete-thread {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    background: transparent;
    border: 1px solid #dc3545;
    color: #dc3545;
    border-radius: 4px;
    padding: var(--sp-2) var(--sp-4);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    width: 100%;
    justify-content: center;
}

.delete-thread-group .action-delete-thread:hover:not(:disabled) {
    background: #dc3545;
    color: #fff;
}

.delete-thread-group .action-delete-thread:disabled {
    border-color: #ccc;
    color: #aaa;
    cursor: not-allowed;
    opacity: 0.6;
}

.delete-thread-group .action-delete-thread .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

.delete-thread-group .description {
    margin: var(--sp-2) 0 0;
    font-size: 11px;
    color: #999;
    font-style: italic;
    text-align: center;
}

.notes-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    flex: 1;
}

.coming-soon {
    margin: var(--sp-1) 0 0;
    font-size: 12px;
    color: #999;
    font-style: italic;
}

.chat-header {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.chat-contact-info {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    flex: 1;
}

.contact-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.contact-name-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--sp-2);
}

.contact-name-row #messaging-window-badge {
    margin-left: auto;
}

.contact-phone-sub {
    font-size: 13px;
    color: #6b7280;
    font-weight: 400;
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-contact-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--sp-2);
    margin-top: var(--sp-1);
}

.view-history-button {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    padding: 0;
}

.view-history-button:hover,
.view-history-button:focus {
    color: #1d4ed8;
    outline: none;
}

.chat-category-badge {
    background: #eef2ff;
    color: #3730a3;
    padding: var(--sp-1) var(--sp-3);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.chat-thread-tag {
    font-size: 12px;
    font-weight: 600;
    color: #701a75;
    font-family: monospace;
    letter-spacing: 0.02em;
}

.chat-thread-badge {
    font-family: monospace;
}

.messaging-window-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px var(--sp-2);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: 1px solid currentColor;
    background: transparent;
    opacity: 0.8;
    flex-shrink: 0;
}

.messaging-window-open {
    color: #15803d;
}

.messaging-window-expired {
    color: #b45309;
}

.contact-details h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.01em;
}

.contact-status {
    font-size: 12px;
    color: #666;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: var(--sp-5);
    background: #f8f9fa;
    min-width: 0; /* Prevent flex overflow */
}

.no-conversation-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #666;
}

.welcome-message .dashicons {
    font-size: 48px;
    margin-bottom: var(--sp-4);
    opacity: 0.5;
}

.welcome-message h3 {
    margin: 0 0 var(--sp-2) 0;
    color: #23282d;
}

.welcome-message p {
    margin: 0;
    color: #666;
}

.message-bubble {
    max-width: 70%;
    width: fit-content;
    margin-bottom: var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    border-radius: 18px;
    word-wrap: break-word;
    word-break: break-word; /* Break long words */
    overflow-wrap: break-word; /* Modern overflow handling */
    hyphens: auto; /* Auto-hyphenate long words */
    position: relative;
}

.message-received {
    background: #e9ecef;
    color: #23282d;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message-sent {
    background: #2196f3;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-system {
    background: #fffbe6;
    color: #4b5563;
    border: 1px dashed #fbbf24;
    border-radius: 12px;
    margin: 0 auto var(--sp-4);
    display: block;
    max-width: 60%;
    text-align: center;
}

.message-system-summary {
    font-weight: 600;
}

.message-system-details {
    margin-top: var(--sp-2);
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
    word-break: break-word;
}

.message-pending {
    opacity: 0.6;
}

.message-failed {
    background: #fee2e2;
    border: 1px solid #ef4444;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-failed-indicator {
    margin-top: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    background: #fecaca;
    border-radius: 6px;
    font-size: 11px;
    color: #b91c1c;
    line-height: 1.4;
}

.message-failed-indicator .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: var(--sp-1);
}

.message-system.message-sent {
    margin-left: auto;
    margin-right: auto;
}

.message-meta-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: var(--sp-2);
}

.message-bubble.message-system .message-content {
    font-size: 13px;
}

.message-bubble.message-system .message-time {
    text-align: center;
    color: #6b7280;
}

.message-content {
    margin-bottom: var(--sp-1);
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
}

.message-received .message-time {
    text-align: left;
}

.chat-input {
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid #ddd;
    background: #fff;
}

.chat-input-hidden,
.chat-input.is-hidden {
    display: none;
}

.input-container {
    display: flex;
    align-items: end;
    gap: var(--sp-3);
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: var(--sp-2) var(--sp-3);
    flex-shrink: 0; /* Prevent shrinking */
    min-width: 0; /* Allow proper flex behavior */
}

#message-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    padding: var(--sp-2) 0;
    min-width: 0; /* Allow text truncation if needed */
}

#send-message {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #2196f3;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

#send-message:hover {
    background: #1976d2;
}

#send-message:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Media Upload Button */
.media-upload-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s;
}

.media-upload-btn:hover {
    background: #e0e0e0;
}

.media-upload-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #555;
}

/* Media Preview Container */
.media-preview-container {
    padding: var(--sp-3) var(--sp-4);
    display: none;
}

.media-preview-container:not(:empty) {
    display: block;
}

.media-preview {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    position: relative;
}

.media-preview.upload-complete {
    border-color: #4caf50;
}

.preview-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.preview-icon {
    font-size: 40px !important;
    width: 40px !important;
    height: 40px !important;
    color: #666;
}

.preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    min-width: 0;
}

.preview-filename {
    font-weight: 500;
    color: #333;
    word-break: break-all;
    font-size: 13px;
}

.preview-size {
    font-size: 12px;
    color: #888;
}

.preview-remove {
    position: absolute;
    top: var(--sp-1);
    right: var(--sp-1);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #f44336;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-remove:hover {
    background: #d32f2f;
}

.preview-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #eee;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #2196f3;
    width: 0;
    transition: width 0.2s;
}

/* Message Media Display */
.message-media {
    margin-bottom: var(--sp-1);
}

.message-media-image .message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
}

.message-media-image .message-image:hover {
    opacity: 0.9;
}

.message-document {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3);
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.message-document .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #1976d2;
}

.document-link {
    color: #1976d2;
    text-decoration: none;
    word-break: break-all;
}

.document-link:hover {
    text-decoration: underline;
}

.media-caption {
    margin-top: var(--sp-2);
    font-size: 14px;
}

.auto-refresh-active {
    background-color: #46b450 !important;
    border-color: #46b450 !important;
    color: white !important;
}

.update-info {
    margin: var(--sp-3) 0 0 0;
    padding: 0;
    text-align: right;
    font-size: 12px;
    color: #666;
}

/* Loading state */
.loading {
    text-align: center;
    padding: var(--sp-5);
    color: #666;
}

.error {
    color: #dc3545;
    padding: var(--sp-5);
    text-align: center;
}

.no-messages {
    text-align: center;
    padding: var(--sp-10) var(--sp-5);
    color: #666;
}

/* Settings Page Styles */
.primedesk-settings-notice {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 5px;
    padding: var(--sp-4);
    margin: var(--sp-5) 0;
}

.primedesk-settings-notice h3 {
    margin-top: 0;
    color: #0073aa;
}

.primedesk-settings-notice ol {
    margin: var(--sp-3) 0 0 var(--sp-5);
}

.primedesk-settings-notice li {
    margin-bottom: var(--sp-1);
}

.primedesk-settings-sections {
    display: grid;
    gap: var(--sp-8);
}

.primedesk-dashboard-link {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    margin-bottom: var(--sp-3);
}

.primedesk-dashboard-link .button {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    background: #fff;
    color: #667eea;
    border: none;
    font-weight: 600;
    padding: var(--sp-2) var(--sp-4);
    height: auto;
}

.primedesk-dashboard-link .button:hover {
    background: #f0f0f0;
    color: #764ba2;
}

.primedesk-dashboard-link .button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.primedesk-dashboard-link .description {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 14px;
}

.primedesk-settings-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: var(--sp-5);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.primedesk-settings-section h2 {
    margin-top: 0;
    margin-bottom: var(--sp-5);
    color: #23282d;
    border-bottom: 2px solid #0073aa;
    padding-bottom: var(--sp-3);
}

.required {
    color: #d63638;
    font-weight: bold;
}

.primedesk-settings-actions {
    margin-top: var(--sp-8);
    padding: var(--sp-5);
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

.primedesk-settings-actions .button {
    margin-right: var(--sp-3);
    min-width: 120px;
}

.connection-status {
    margin-left: var(--sp-4);
    font-weight: bold;
    padding: var(--sp-1) var(--sp-3);
    border-radius: 3px;
    display: inline-block;
}

.connection-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.connection-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.connection-status.testing {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Modal styles */
.whatsapp-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.whatsapp-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: var(--sp-5);
    border: 1px solid #888;
    width: 60%;
    max-width: 700px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
    border-radius: 5px;
}

.whatsapp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid #ddd;
}

.whatsapp-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.whatsapp-modal-close:hover {
    color: black;
}

.whatsapp-modal-body {
    padding: var(--sp-5) 0;
}

.whatsapp-modal-footer {
    padding-top: var(--sp-3);
    border-top: 1px solid #ddd;
    text-align: right;
}

#test-results-content {
    min-height: 100px;
    padding: var(--sp-4);
    background: #f9f9f9;
    border-radius: 3px;
    white-space: pre-wrap;
    font-family: monospace;
}

/* Team Members */
.team-members-page .wp-heading-inline {
    margin-right: var(--sp-3);
}

.team-members-page .team-members-description {
    margin-top: var(--sp-3);
    max-width: 680px;
}

.team-members-page #add-team-member {
    vertical-align: middle;
}

.team-members-table {
    margin-top: var(--sp-5);
}

.team-members-table .column-actions button + button {
    margin-left: var(--sp-2);
}

.action-group.assigned-member-group .assignment-controls {
    margin-top: var(--sp-3);
}

.action-group.assigned-member-group .assignment-controls select {
    width: 220px;
    max-width: 100%;
}

.team-member-status {
    display: inline-block;
    padding: 0 var(--sp-3);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.team-member-status.status-active {
    background: #dcfce7;
    color: #166534;
}

.team-member-status.status-inactive {
    background: #fee2e2;
    color: #b91c1c;
}

.team-members-notice {
    margin: var(--sp-3) 0;
    padding: var(--sp-3) var(--sp-4);
    display: none;
}

.team-member-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.team-member-modal__content {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 600px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.25);
}

.team-member-modal__content h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2937;
}

.team-member-modal__close {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}

.team-member-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-5);
}

.team-member-form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--sp-2);
}

.team-member-form-field input,
.team-member-form-field select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: var(--sp-2);
}

.team-member-category-panel {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: var(--sp-3) var(--sp-4);
}

.team-member-category-panel .description {
    margin-top: var(--sp-2);
    font-size: 0.85rem;
    color: #6b7280;
}

.team-member-category-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.team-member-category-option {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
}

.team-member-category-option input[type="checkbox"] {
    width: auto;
    height: auto;
    margin: 0;
}

.team-member-form-field.checkbox-field {
    grid-column: 1;
}

.team-member-form-field.checkbox-field label {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: 0;
}

.team-member-form-field.checkbox-field input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.team-member-form-actions {
    margin-top: var(--sp-5);
    display: flex;
    gap: var(--sp-3);
    justify-content: flex-end;
}

/* ── Responsive Design ───────────────────────────────────────────── */

/* Large tablets and small desktops */
@media (max-width: 1200px) {
    .primedesk-layout {
        height: calc(100vh - 100px);
    }

    .conversations-panel {
        flex: 0 0 280px;
        min-width: 250px;
        max-width: 30%;
    }

    .chat-panel {
        min-width: 350px;
    }

    .actions-panel {
        flex: 0 0 250px;
        min-width: 220px;
        max-width: 22%;
    }
}

/* Tablets */
@media (max-width: 992px) {
    .primedesk-layout {
        flex-direction: row;
        height: calc(100vh - 100px);
    }

    .conversations-panel {
        flex: 0 0 260px;
        min-width: 240px;
        max-width: 28%;
    }

    .chat-panel {
        min-width: 300px;
        flex: 1 1 auto;
    }

    .actions-panel {
        flex: 0 0 220px;
        min-width: 200px;
        max-width: 20%;
    }
}

/* ── Mobile-only base styles (hidden on desktop) ─────────────────────────── */
.pd-mobile-header {
    display: none;
}

.pd-drawer-overlay {
    display: none;
}

.pd-drawer-close {
    display: none;
}

.conversations-header,
.actions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Mobile: drawer-based layout (<= 768px) ──────────────────────────────── */
@media (max-width: 768px) {
    /* Layout fills the viewport */
    .primedesk-wrap {
        padding: 0;
        max-height: 100dvh;
        overflow: hidden;
    }

    .primedesk-layout {
        flex-direction: column;
        height: 100dvh;
        border: none;
        border-radius: 0;
        margin: 0;
        position: relative;
    }

    /* Mobile header bar */
    .pd-mobile-header {
        display: flex;
        align-items: center;
        padding: 0 var(--sp-2);
        height: 56px;
        min-height: 56px;
        background: #fff;
        border-bottom: 1px solid #ddd;
        flex-shrink: 0;
        gap: var(--sp-1);
        z-index: 10;
    }

    .pd-mobile-header-title {
        flex: 1;
        font-size: 16px;
        font-weight: 600;
        color: #1d2327;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 0 var(--sp-2);
    }

    .pd-mobile-btn {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        border-radius: 50%;
        flex-shrink: 0;
        color: #1d2327;
        padding: 0;
    }

    .pd-mobile-btn:hover,
    .pd-mobile-btn:focus {
        background: #f0f0f0;
        outline: none;
    }

    /* Chat panel fills remaining space */
    .chat-panel {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 0;
        width: 100%;
        max-width: 100%;
        border: none;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
    }

    /* Slide-in drawers */
    .conversations-panel,
    .actions-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        width: min(85vw, 360px);
        height: 100%;
        flex: none;
        max-width: 360px;
        max-height: none;
        z-index: 1001;
        transition: transform 0.28s ease;
        overflow-y: auto;
        overflow-x: hidden;
        border-bottom: none;
        border-top: none;
        border-radius: 0;
    }

    .conversations-panel {
        left: 0;
        transform: translateX(-100%);
        border-right: 1px solid #ddd;
        border-left: none;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.18);
    }

    .actions-panel {
        right: 0;
        transform: translateX(100%);
        border-left: 1px solid #ddd;
        border-right: none;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.18);
    }

    .conversations-panel.pd-drawer-open {
        transform: translateX(0);
    }

    .actions-panel.pd-drawer-open {
        transform: translateX(0);
    }

    /* Dim overlay behind open drawer */
    .pd-drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.28s ease;
    }

    .pd-drawer-overlay.pd-drawer-open {
        opacity: 1;
        pointer-events: auto;
    }

    /* Close button inside drawer headers */
    .pd-drawer-close {
        display: flex;
    }

    /* Horizontally scrollable filter tabs */
    .conversation-filter-bar {
        padding: var(--sp-3);
    }

    .conversation-category-tabs,
    .conversation-status-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .conversation-category-tabs::-webkit-scrollbar,
    .conversation-status-tabs::-webkit-scrollbar {
        display: none;
    }

    /* Larger tap targets */
    .conversation-item {
        min-height: 64px;
    }

    .thread-item {
        min-height: 44px;
    }

    /* Chat input */
    .chat-input .input-container {
        padding: var(--sp-3);
    }

    /* Actions panel scrollable */
    .actions-body {
        overflow-y: auto;
        max-height: none;
    }

    /* Modal */
    .whatsapp-modal-content {
        width: 90%;
        margin: 10% auto;
    }
}

/* ── Small phones (<= 480px) ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .chat-input .input-container {
        padding: var(--sp-2) var(--sp-3);
    }

    #message-input {
        min-height: 60px;
    }
}

/* ── Template Sender (in-chat) ───────────────────────────────────────────── */

/* Proactive "Use Template" button in normal chat bar */
.use-template-proactive-btn {
    background: none;
    border: 1px solid #c3c4c7;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.use-template-proactive-btn:hover {
    background: #f0f0f0;
    color: #1d2327;
}

/* Template selector panel */
.template-selector {
    border-top: 1px solid #ddd;
    background: #fafafa;
    flex-shrink: 0;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Step: pick */
.tpl-pick-header {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4) var(--sp-2);
    background: #fff8e1;
    border-bottom: 1px solid #f0e6b2;
}
.tpl-expired-icon { color: #f59e0b; font-size: 20px; margin-top: 0; flex-shrink: 0; }
.tpl-expired-title { display: block; font-size: 13px; color: #92400e; }
.tpl-expired-desc { margin: 0 0 0; font-size: 12px; color: #78350f; }
.tpl-close-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #888;
    flex-shrink: 0;
    line-height: 1;
}
.tpl-close-btn:hover { color: #1d2327; }
.tpl-search-row { padding: var(--sp-2) var(--sp-4); }
.tpl-search-input {
    width: 100%;
    max-width: 360px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: var(--sp-1) var(--sp-3);
    font-size: 13px;
}

/* Template cards list */
.tpl-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 0 var(--sp-3) var(--sp-3);
}
.tpl-list-loading,
.tpl-list-empty { color: #888; font-size: 13px; padding: var(--sp-2) var(--sp-1); }
.tpl-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: var(--sp-3) var(--sp-3);
    margin: var(--sp-2) 0;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.tpl-card:hover { border-color: #2271b1; box-shadow: 0 0 0 2px rgba(34,113,177,.12); }
.tpl-card-name { font-weight: 600; font-size: 13px; color: #1d2327; }
.tpl-card-lang  { font-size: 11px; color: #888; margin-left: var(--sp-2); }
.tpl-card-body  { font-size: 12px; color: #555; margin-top: var(--sp-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Step: compose */
.tpl-step-compose {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.tpl-compose-header {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}
.tpl-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #2271b1;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
}
.tpl-back-btn:hover { text-decoration: underline; }
.tpl-compose-body {
    display: flex;
    gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    flex-wrap: wrap;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.tpl-var-inputs { flex: 1 1 180px; }
.tpl-var-inputs label { display: block; font-size: 12px; color: #555; margin-bottom: var(--sp-1); }
.tpl-var-inputs input[type="text"] {
    width: 100%;
    margin-bottom: var(--sp-3);
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: var(--sp-1) var(--sp-2);
    font-size: 13px;
}
.tpl-preview-wrap { flex: 0 0 200px; }
.tpl-preview-label { font-size: 11px; color: #888; margin: 0 0 var(--sp-2); text-transform: uppercase; letter-spacing: .4px; }
.tpl-compose-footer {
    display: flex;
    justify-content: flex-end;
    padding: var(--sp-2) var(--sp-4) var(--sp-3);
    border-top: 1px solid #e0e0e0;
}
.tpl-send-btn { display: flex; align-items: center; gap: var(--sp-2); }

/* Shared bubble styles (reused from templates-page.php) */
.pd-whatsapp-bubble-wrap {
    background: #e5ddd5;
    border-radius: 8px;
    padding: var(--sp-3);
}
.pd-whatsapp-bubble {
    background: #fff;
    border-radius: 8px 8px 8px 0;
    padding: var(--sp-2) var(--sp-3) var(--sp-1);
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
    font-size: 12px;
    line-height: 1.5;
    word-break: break-word;
}
.pd-bubble-header { font-weight: 600; margin-bottom: var(--sp-1); }
.pd-bubble-footer { color: #888; font-size: 11px; margin-top: var(--sp-1); }
.pd-bubble-time { text-align: right; color: #aaa; font-size: 10px; margin-top: var(--sp-1); }

/* ==========================================================================
   Contacts Page (Admin)
   ========================================================================== */

.pd-contacts-wrap {
    max-width: 1280px;
}

/* ── Page header ── */
.pd-contacts-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--sp-3);
    margin: var(--sp-4) 0 var(--sp-5);
}

.pd-contacts-title-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.pd-contacts-title-row .wp-heading-inline {
    margin: 0;
}

.pd-contacts-count-badge {
    background: #eef2ff;
    color: #4f46e5;
    font-size: 11px;
    font-weight: 700;
    padding: 2px var(--sp-2);
    border-radius: 999px;
    min-width: 22px;
    text-align: center;
    letter-spacing: 0.01em;
}

.pd-contacts-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.pd-contacts-actions-divider {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
    margin: 0 var(--sp-1);
    flex-shrink: 0;
}

/* ── Search ── */
.pd-contacts-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.pd-contacts-search-wrap .pd-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    flex-shrink: 0;
    transition: color 0.15s;
}

.pd-contacts-search-wrap:focus-within .pd-search-icon {
    color: #2271b1;
}

.pd-contacts-search-input {
    padding: 6px 34px 6px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    color: #1d2327;
    width: 220px;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    line-height: 1.4;
}

.pd-contacts-search-input::placeholder {
    color: #b0b7c3;
}

.pd-contacts-search-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* ── Buttons ── */
.pd-btn-contacts-secondary {
    display: inline-flex !important;
    align-items: center;
    gap: var(--sp-1);
}

.pd-btn-add-contact {
    display: inline-flex !important;
    align-items: center;
    gap: var(--sp-1);
}

.pd-btn-danger {
    background: #d63638 !important;
    border-color: #d63638 !important;
    color: #fff !important;
}

.pd-btn-danger:hover {
    background: #b32d2e !important;
    border-color: #b32d2e !important;
}

/* ── Table ── */
.pd-contacts-table-wrap {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.pd-contacts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pd-contacts-table thead {
    background: #f9fafb;
    border-bottom: 1px solid #e9eaec;
    position: sticky;
    top: 0;
    z-index: 1;
}

.pd-contacts-table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.pd-contacts-table th.pd-sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.12s;
}

.pd-contacts-table th.pd-sortable:hover {
    color: #374151;
}

.pd-contacts-table th.pd-sort-asc,
.pd-contacts-table th.pd-sort-desc {
    color: #2271b1;
}

.pd-sort-icon {
    display: inline-flex;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.8;
}

.pd-contacts-table td {
    padding: 12px 16px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    font-size: 13px;
}

.pd-contacts-table tbody tr:last-child td {
    border-bottom: none;
}

.pd-contacts-table tbody tr {
    transition: background 0.1s;
}

.pd-contacts-table tbody tr:hover td {
    background: #f0f4ff;
}

.pd-td-clickable {
    cursor: pointer;
}

.pd-contacts-table tbody tr.pd-row-history td {
    color: #b0b7c3;
}

.pd-phone-display {
    color: #2271b1;
    font-weight: 500;
}

.pd-cell-empty {
    color: #d1d5db;
    font-style: italic;
    font-size: 12px;
}

.col-actions {
    width: 80px;
    text-align: right;
    white-space: nowrap;
}

/* ── Loading / empty states ── */
.pd-contacts-loading {
    text-align: center;
    padding: 48px var(--sp-6);
    color: #6b7280;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
}

.pd-contacts-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: pd-contacts-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes pd-contacts-spin {
    to { transform: rotate(360deg); }
}

.pd-contacts-empty {
    text-align: center;
    padding: 56px var(--sp-6) 48px;
    color: #9ca3af;
}

.pd-contacts-empty svg {
    opacity: 0.5;
}

.pd-contacts-empty p {
    margin: var(--sp-3) 0 var(--sp-4);
    font-size: 14px;
    color: #6b7280;
}

/* ── Action buttons ── */
.pd-contacts-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: #d1d5db;
    cursor: pointer;
    transition: all 0.12s;
    padding: 0;
}

tr:hover .pd-contacts-action-btn {
    color: #9ca3af;
    border-color: #e5e7eb;
    background: #fff;
}

.pd-contacts-action-btn svg {
    display: block;
    width: 14px;
    height: 14px;
}

.pd-contacts-action-btn:hover {
    color: #374151 !important;
    border-color: #d1d5db !important;
    background: #f3f4f6 !important;
}

.pd-contacts-action-btn.pd-btn-delete:hover {
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
    background: #fff5f5 !important;
}

/* ── Modal ── */
.pd-contact-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
}

.pd-contact-modal {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}

.pd-contact-modal-sm {
    max-width: 420px;
}

.pd-contact-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4) var(--sp-5);
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.pd-contact-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    letter-spacing: -0.01em;
}

.pd-contact-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: #f1f2f6;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: background 0.12s, color 0.12s;
    padding: 0;
}

.pd-contact-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

/* ── Contact form — side by side grid ── */
.pd-contact-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: var(--sp-5);
}

.pd-contact-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.pd-contact-form-group label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Address spans full width */
.pd-contact-form-full {
    grid-column: 1 / -1;
}

.pd-contact-input {
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #1d2327;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.4;
}

.pd-contact-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.pd-contact-input::placeholder {
    color: #c4c9d4;
}

.pd-contact-textarea {
    resize: vertical;
    min-height: 56px;
}

.pd-contact-form-error {
    margin: 0 var(--sp-5) var(--sp-2);
    font-size: 12px;
    color: #d63638;
    padding: var(--sp-2) var(--sp-3);
    background: #fef2f2;
    border-radius: 4px;
    border: 1px solid #fca5a5;
}

.pd-contact-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5) var(--sp-4);
    border-top: 1px solid #f3f4f6;
}

.pd-delete-confirm-text {
    margin: var(--sp-5);
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
}

/* ── Toast ── */
.pd-contacts-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 200000;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.pd-contacts-toast.pd-toast-success {
    background: #1d2327;
    color: #f1f5f9;
}

.pd-contacts-toast.pd-toast-error {
    background: #fef2f2;
    color: #d63638;
    border: 1px solid #fca5a5;
}

/* ── Responsive ── */
@media (max-width: 782px) {
    .pd-contacts-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .pd-contacts-search-input {
        width: 100%;
    }

    .pd-contacts-table th.col-address,
    .pd-contacts-table td.col-address,
    .pd-contacts-table th.col-country,
    .pd-contacts-table td.col-country {
        display: none;
    }

    .pd-contact-form-grid {
        grid-template-columns: 1fr;
    }
}
