* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}
.container {
    max-width: 1800px;
    margin: 0 auto;
   padding-left: 2px;
    padding-right: 2px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 35px rgba(0,0,0,0.2);
    padding: 30px;
}
.admin-links {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.admin-links a {
    background: #f1f5f9;
    padding: 8px 16px;
    border-radius: 30px;
    text-decoration: none;
    color: #1e293b;
    font-weight: 500;
    transition: all 0.2s;
}
.admin-links a:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}
h1, h2 {
    color: #0f172a;
    margin-bottom: 20px;
}
h1 {
    font-size: 28px;
    border-left: 5px solid #667eea;
    padding-left: 15px;
}
.form-group {
    margin-bottom: 20px;
}
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #334155;
}
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.2);
}
button, .btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
button:hover, .btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}
.btn-success {
    background: #10b981;
}
.btn-success:hover {
    background: #059669;
}
.btn-warning {
    background: #f59e0b;
}
.btn-warning:hover {
    background: #d97706;
}
.btn-danger {
    background: #ef4444;
}
.btn-danger:hover {
    background: #dc2626;
}
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
th {
    background: #f8fafc;
    font-weight: 600;
    color: #0f172a;
}
tr:hover td {
    background: #f1f5f9;
}
.status-sent {
    background: #e0f2e7;
    color: #15803d;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}
.status-failed {
    background: #fee2e2;
    color: #b91c1c;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}
.chats-grid {
    column-count: 3;
    column-gap: 20px;
    max-height: 550px;
    overflow-y: auto;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.chats-grid label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
    cursor: pointer;
}
.select-all-wrapper {
    margin: 10px 0;
    padding: 10px;
    background: #eef2ff;
    border-radius: 8px;
}
.duplicate-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 380px;
    background: white;
    border-left: 5px solid #f59e0b;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    padding: 16px;
    z-index: 10000;
    border-radius: 12px;
    animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.duplicate-notification .dn-title { font-weight: bold; margin-bottom: 10px; font-size: 16px; }
.duplicate-notification .dn-list { margin-bottom: 15px; font-size: 13px; color: #475569; max-height: 150px; overflow-y: auto; }
.duplicate-notification .dn-buttons { display: flex; gap: 10px; justify-content: flex-end; }
.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    background: white;
    text-decoration: none;
    color: #334155;
    border-radius: 6px;
    transition: all 0.2s;
}
.pagination a:hover {
    background: #e2e8f0;
}
.pagination .active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}
.message-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: white;
}
.message-item:hover { background: #f8fafc; }
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: #475569;
}
.message-text {
    margin: 8px 0;
    word-break: break-word;
    white-space: pre-wrap;
}
.delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 12px;
}
.delete-btn:hover { background: #dc2626; }
.loading { text-align: center; padding: 20px; color: #667eea; }
.select-all { margin: 15px 0; display: flex; align-items: center; gap: 10px; }
.bulk-delete { margin-top: 20px; text-align: center; }
.chat-selector { background: #f8fafc; padding: 20px; border-radius: 16px; margin-bottom: 25px; }
@media (max-width: 768px) {
    .container { padding: 20px; }
    .chats-grid { column-count: 1; }
    .admin-links { flex-direction: column; }
}
/* Дополнительные стили для поиска и адаптации */
.search-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.search-group input {
    flex: 1;
    min-width: 200px;
}
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 15px 0;
}
.btn-group button {
    white-space: nowrap;
}
.chats-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    cursor: pointer;
    white-space: normal;
    word-break: break-word;
}
.chats-grid input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
}
.form-group .flex-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
@media (max-width: 768px) {
    .btn-group button {
        width: 100%;
    }
}
.select-all-wrapper {
    margin: 10px 0;
    padding: 8px 12px;
    background: #eef2ff;
    border-radius: 8px;
    display: flex;
    align-items: center;
}
.select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    margin: 0;
}
.select-all-label input {
    width: auto;
    margin: 0;
}

/* Для всех меток в формах, содержащих чекбоксы */
.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.form-group label input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

.chats-list {
    max-height: 550px;
    overflow-y: auto;
    padding: 10px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.chats-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    cursor: pointer;
}
.btn-info { background: #17a2b8; color: white; }
.btn-info:hover { background: #138496; }
textarea[name="message"] {
    min-height: 400px;
}
.input-error {
    border: 2px solid #ef4444 !important;
    background-color: #fee2e2;
}