.mail-layout {
    display: flex;
    height: 80vh;
    background: #f4f6f9;
    border-radius: 10px;
    overflow: hidden;
}

/* SIDEBAR */
.mail-sidebar {
    width: 260px;
    background: #1f2937;
    color: #fff;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.mail-user {
    font-size: 14px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.mail-folder {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    color: #ddd;
    text-decoration: none;
    margin-bottom: 5px;
    transition: 0.2s;
}

.mail-folder:hover {
    background: #374151;
    color: #fff;
}

.mail-folder.active {
    background: #16a34a;
    color: #fff;
}

/* CONTENT */
.mail-content {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.mail-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mail-header h4 {
    margin: 0;
}

/* LIST */
.mail-list {
    overflow-y: auto;
}

.mail-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f1f1f1;
    transition: 0.2s;
}

.mail-item:hover {
    background: #f9fafb;
}

.mail-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
}

.mail-info {
    flex: 1;
}

.mail-top {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.mail-from {
    font-weight: 600;
}

.mail-date {
    color: #999;
    font-size: 13px;
}

.mail-subject a {
    text-decoration: none;
    color: #333;
}

.mail-subject a:hover {
    text-decoration: underline;
}

.mail-actions a {
    display: inline-block;
    background: #dc2626;
    color: #ffffff;
    font-size: 14px;
    padding: 6px 11px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mail-actions a:hover {
    background: #b91c1c; /* rojo un poco más oscuro */
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

/* EMPTY */
.mail-empty {
    padding: 40px;
    text-align: center;
    color: #888;
}

/* RESPONSIVE */
@media (max-width: 768px) {

    .mail-layout {
        flex-direction: column;
        height: auto;
    }

    .mail-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }

    .mail-folder {
        margin-right: 10px;
    }

}
/* ===============================
   RESPONSIVE PRO
=================================*/

@media (max-width: 992px) {

    .mail-layout {
        height: auto;
        flex-direction: column;
    }

    .mail-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px;
    }

    .mail-user {
        width: 100%;
        margin-bottom: 10px;
        font-size: 13px;
        opacity: 0.9;
    }

    .mail-folder {
        flex: 1;
        text-align: center;
        margin-bottom: 0;
        padding: 10px;
        font-size: 14px;
    }

    .mail-sidebar .btn {
        width: 100%;
        margin-top: 10px;
    }

    .mail-content {
        border-radius: 0;
    }

    .mail-header {
        padding: 15px;
        font-size: 18px;
        align-items: flex-start;
        flex-direction: column;
    }

    .mail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 15px;
    }

    .mail-top {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }

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

    .mail-avatar {
        width: 38px;
        height: 38px;
        font-size: 14px;
        margin-bottom: 5px;
    }

    .mail-actions {
        width: 100%;
        text-align: right;
        margin-top: 5px;
    }

}

/* ===============================
   MAIL READ PREMIUM
=================================*/

.mail-read-wrapper {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    background: #f4f6f9;
}

.mail-read-card {
    width: 100%;
    max-width: 1000px;
    background: #ffffff;
    border-radius: 14px;
    padding: 35px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.mail-read-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.mail-back {
    text-decoration: none;
    color: #555;
    font-weight: 500;
}

.mail-delete {
    text-decoration: none;
    color: #dc2626;
    font-weight: 500;
}

.btn-delete-mail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #dc2626;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-delete-mail:hover {
    background: #b91c1c;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.btn-delete-mail:hover {
    background: #b91c1c;
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.mail-read-title {
    font-size: 30px;
    margin-bottom: 25px;
}

.mail-read-meta {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.mail-read-from {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mail-read-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.mail-read-sender {
    font-weight: 600;
}

.mail-read-date {
    font-size: 13px;
    color: #777;
}

.mail-read-body {
    margin-top: 20px;
}

.mail-iframe {
    width: 100%;
    min-height: 120px;
    border: none;
    border-radius: 8px;
    background: #fff;
}

/* ATTACHMENTS */

.mail-attachments {
    margin-top: 35px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.mail-attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.mail-attachment-card {
    background: #f9fafb;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.mail-attachment-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: #16a34a;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}

.mail-file-wrapper {
    margin-top: 15px;
}

.mail-file-button {
    display: inline-block;
    padding: 12px 16px;
    background: #f1f5f9;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    font-weight: 500;
    color: #1f2937;
    text-decoration: none;
    transition: all .2s ease;
}

.mail-file-button:hover {
    background: #e0f2fe;
    border-color: #3b82f6;
    color: #1d4ed8;
}
/* ===============================
   RESPONSIVE
=================================*/

@media (max-width: 768px) {

    .mail-read-wrapper {
        padding: 20px 10px;
    }

    .mail-read-card {
        padding: 20px;
    }

    .mail-read-title {
        font-size: 20px;
    }

    .mail-iframe {
        min-height: 120px;
    }

}

.mail-read-header {
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
}

.mail-read-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-back {
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.btn-back:hover {
    background: #f1f5f9;
}

.btn-delete {
    background: #dc2626;
    color: white;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

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

.mail-read-subject {
    font-size: 22px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 20px;
}

.mail-read-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mail-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mail-user-info {
    display: flex;
    flex-direction: column;
}

.mail-from-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.mail-from-label {
    font-size: 12px;
    color: #94a3b8;
}

.mail-read-date {
    font-size: 13px;
    color: #64748b;
}


.mail-compose {
    max-width: 1120px;
    margin: 24px auto;
    padding: 28px 36px;
    background: white;
    border-radius: 8px;
    border: 1px solid #eef2f7;
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.06);
}

.compose-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 14px;
    color: #0f172a;
}

.mail-compose > .mb-3 {
    margin-bottom: 20px !important;
}

.mail-compose .btn-light {
    border: 1px solid #d8dee8;
    background: #fff;
    color: #334155;
    border-radius: 6px;
    padding: 8px 13px;
    font-weight: 600;
}

.compose-group {
    margin-bottom: 16px;
}

.compose-group label {
    display: block;
    margin-bottom: 6px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.compose-grid.two {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.form-control-modern {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid #d8dee8;
    border-radius: 6px;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
}

.form-control-modern:focus {
    border-color: #2f7d32;
    box-shadow: 0 0 0 3px rgba(47, 125, 50, 0.12);
    outline: none;
}

.email-input-wrapper {
    min-height: 46px;
    border: 1px solid #d8dee8;
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    background: #fff;
}

.email-input-wrapper:focus-within {
    border-color: #2f7d32;
    box-shadow: 0 0 0 3px rgba(47, 125, 50, 0.12);
}

.email-input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 200px;
    padding: 6px;
}

.email-chip {
    background: #e8f4ea;
    color: #1f6f32;
    padding: 6px 10px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    font-size: 13px;
    gap: 6px;
}

.email-chip.invalid {
    background: #fee2e2;
    color: #b91c1c;
}

.email-chip span {
    cursor: pointer;
    font-weight: bold;
}

.mail-wrapper {
    font-family: Arial, sans-serif;
}

.mail-main {
    margin-bottom: 20px;
}

.mail-text {
    font-size: 15px;
    margin-bottom: 8px;
}

.mail-attachments {
    margin: 20px 0;
}

.attachment-card {
    background: #f1f3f4;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.attachment-icon {
    font-size: 20px;
    margin-right: 10px;
}

.attachment-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.attachment-link {
    background: #1a73e8;
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
}

.attachment-link:hover {
    background: #1558c0;
}

.mail-thread {
    margin-top: 30px;
    padding: 15px;
    background: #fafafa;
    border-left: 3px solid #ccc;
}

.thread-header {
    font-weight: bold;
    margin-bottom: 10px;
}


.file-upload-box {
    position: relative;
    border: 1px dashed #b7c2d0;
    padding: 18px;
    border-radius: 8px;
    background: #f8fafc;
    transition: 0.3s;
}

.file-upload-box:hover {
    border-color: #198754;
    background: #f3fdf6;
}

.file-preview {
    margin-top: 15px;
}

.file-item {
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #eee;
}

.progress {
    height: 6px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,#198754,#20c997);
    transition: width 0.2s ease;
}

.compose-actions {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #edf2f7;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-cancel {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #d8dee8;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}
/* ===== BOTÓN ENVIAR ===== */
.btn-send {
    background: #2f7d32;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    transition: .2s;
    position: relative;
}

.btn-send:hover {
    background: #27692a;
}

.mail-settings-panel,
.mail-settings-locked {
    max-width: 900px;
    margin: 28px auto;
    padding: 28px 34px;
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 8px;
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.06);
}

.mail-settings-header h3,
.mail-settings-locked h3 {
    color: #0f172a;
    font-weight: 700;
}

.mail-settings-header p {
    color: #64748b;
    margin-bottom: 22px;
}

@media (max-width: 768px) {
    .mail-compose,
    .mail-settings-panel,
    .mail-settings-locked {
        margin: 12px;
        padding: 18px;
    }

    .compose-grid.two {
        grid-template-columns: 1fr;
    }

    .compose-actions {
        justify-content: stretch;
        flex-direction: column;
    }

    .btn-send,
    .btn-cancel {
        text-align: center;
    }
}

.btn-send:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-send .spinner {
    width:16px;
    height:16px;
    border:2px solid rgba(255,255,255,.4);
    border-top:2px solid white;
    border-radius:50%;
    display:inline-block;
    margin-left:8px;
    animation:spin .6s linear infinite;
}

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

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: #111827;
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,.2);
    margin-bottom: 10px;
    opacity: 0;
    transform: translateX(20px);
    transition: .3s;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

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

/* ===== PROGRESS BAR ===== */
.progress {
    background:#e5e7eb;
    border-radius:6px;
    height:6px;
    margin-top:5px;
}

.progress-bar {
    background:#38771d;
    height:100%;
    width:0%;
    border-radius:6px;
    transition: width .3s;
}
