body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

.admin-container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

.admin-header {
    margin-bottom: 40px;
}

.admin-header h1 {
    margin: 0;
    font-size: 3rem;
}

.admin-header p {
    margin-top: 8px;
    color: #6b7280;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
}

.stat-card h2 {
    margin: 0;
    font-size: 3rem;
}

.stat-card p {
    margin-top: 8px;
    color: #6b7280;
}

#messagesContainer {
    display: grid;
    gap: 18px;
}

.login-card{
    max-width:420px;
    margin:80px auto;
    background:#fff;
    padding:40px;
    border-radius:16px;
    box-shadow:0 10px 30px rgba(0,0,0,.08);
    text-align:center;
}

.login-card input{
    width:100%;
    box-sizing:border-box;
    padding:14px;
    font-size:16px;
    margin:20px 0;
    border:1px solid #d1d5db;
    border-radius:10px;
}

.login-card button{
    width:100%;
    padding:14px;
    border:none;
    border-radius:10px;
    background:#2563eb;
    color:white;
    font-size:16px;
    cursor:pointer;
}

.login-card button:hover{
    background:#1d4ed8;
}

.login-error{
    color:#dc2626;
    margin-top:16px;
}

.hidden{
    display:none;
}

.message-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.message-header h3 {
    margin: 0;
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.status.new {
    background: #dcfce7;
    color: #166534;
}

.status.read {
    background: #e5e7eb;
    color: #374151;
}

.message-card p {
    margin: 8px 0;
    color: #4b5563;
}

.message-card button {
    margin-top: 15px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    cursor: pointer;
    font-weight: 600;
}

.message-card button:hover {
    background: #1d4ed8;
}

/* ===========================
   Message Modal
=========================== */

.message-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 1000;
}

.message-modal.hidden {
    display: none;
}

.message-modal-content {
    position: relative;
    width: min(700px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f3f4f6;
    cursor: pointer;
    font-size: 24px;
}

.close-btn:hover {
    background: #e5e7eb;
}

.modal-field {
    margin-bottom: 20px;
}

.modal-field strong {
    display: block;
    margin-bottom: 6px;
    color: #374151;
}

.modal-field p {
    margin: 0;
    color: #111827;
    line-height: 1.6;
    word-break: break-word;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.modal-actions button {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

#markReadBtn {
    background: #2563eb;
    color: white;
}

#markReadBtn:hover {
    background: #1d4ed8;
}

#deleteBtn {
    background: #dc2626;
    color: white;
}

#deleteBtn:hover {
    background: #b91c1c;
}

.message-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 14px 0;
    color: #6b7280;
    font-size: 0.95rem;
}

.message-preview {
    margin: 16px 0;
    line-height: 1.6;
    color: #374151;
}

.message-card button {
    margin-top: 12px;
}

.search-bar {
    margin: 24px 0;
}

.search-bar input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.search-bar input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.filter-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.filter-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    background: #e5e7eb;
    cursor: pointer;
    font-weight: 600;
    transition: .2s;
}

.filter-btn:hover {
    background: #d1d5db;
}

.filter-btn.active {
    background: #2563eb;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    color: #6b7280;
    margin-top: 24px;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #111827;
}

.hidden {
    display: none !important;
}

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
}

.toast {
    min-width: 300px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(0,0,0,.2);
    animation: slideIn .25s ease;
    transition: opacity .3s, transform .3s;
}

.toast.success {
    background: #16a34a;
}

.toast.error {
    background: #dc2626;
}

.toast.info {
    background: #2563eb;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.danger-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    background: #dc2626;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: .2s;
}


.danger-btn:hover {
    background: #b91c1c;
}

#deleteAllInput {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 1rem;
}

#confirmDeleteAllBtn:disabled {
    opacity: .5;
    cursor: not-allowed;
}