.mpi-invoice {
    --mpi-primary: #6d28d9;
    width: 100%;
    max-width: 720px;
    margin: 30px auto;
    background: #eceae6;
    padding: 40px;
    font-family: Tahoma, Arial, sans-serif;
    color: #1f1f1f;
    box-sizing: border-box;
}

.mpi-invoice * {
    box-sizing: border-box;
}

.mpi-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #cfcbc4;
}

.mpi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: opacity .15s ease;
    flex: 1 1 auto;
    min-width: 160px;
}

.mpi-btn:hover {
    opacity: .85;
    color: #fff;
}

.mpi-btn-print {
    background: var(--mpi-primary, #6d28d9);
    color: #fff;
}

.mpi-btn-whatsapp {
    background: #25d366;
    color: #fff;
}

@media print {
    .mpi-actions {
        display: none !important;
    }
    .mpi-invoice {
        margin: 0;
        box-shadow: none;
        background: #fff;
        max-width: none;
        width: 100%;
    }
}

.mpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    flex-wrap: wrap;
    gap: 14px;
}

.mpi-logo img {
    max-width: 90px;
    max-height: 90px;
    display: block;
}

.mpi-logo-placeholder {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mpi-primary), #a78bfa);
}

.mpi-company-name {
    font-size: 34px;
    font-weight: bold;
    color: var(--mpi-primary);
    letter-spacing: 1px;
    word-break: break-word;
}

.mpi-hr {
    border: none;
    border-top: 2px solid #cfcbc4;
    margin: 25px 0;
}

.mpi-client-block {
    text-align: right;
    margin-bottom: 25px;
}

.mpi-client-label {
    font-weight: bold;
    margin: 0 0 6px;
}

.mpi-client-name,
.mpi-client-line {
    margin: 2px 0;
    color: #444;
    word-break: break-word;
}

.mpi-invoice-number {
    margin-top: 10px;
    font-size: 14px;
}

.mpi-table-wrap {
    border: 2px solid var(--mpi-primary);
    border-radius: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mpi-items-table-view {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    background: #eceae6;
}

.mpi-items-table-view th {
    background: #f4f2ee;
    font-weight: bold;
    padding: 14px 10px;
    text-align: center;
    border-bottom: 2px solid var(--mpi-primary);
    font-size: 14px;
    white-space: nowrap;
}

.mpi-items-table-view td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid #d8d4cc;
    font-size: 14px;
}

.mpi-col-item {
    text-align: center;
    word-break: break-word;
}

.mpi-summary-row td {
    border-bottom: 1px solid #d8d4cc;
    font-weight: bold;
}

.mpi-summary-label {
    text-align: center;
}

.mpi-total-row td {
    border-bottom: none;
    font-weight: bold;
    font-size: 17px;
}

.mpi-total-label {
    text-align: center;
}

.mpi-total-value {
    color: #1f1f1f;
    white-space: nowrap;
}

.mpi-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}

.mpi-footer-brand {
    font-weight: bold;
    font-size: 18px;
    letter-spacing: 2px;
}

.mpi-footer-due {
    font-size: 13px;
    color: #444;
}

.mpi-footer-note {
    text-align: center;
    margin-top: 15px;
    font-size: 13px;
    color: #666;
}

/* أجهزة الأجهزة اللوحية */
@media (max-width: 768px) {
    .mpi-invoice {
        padding: 28px 20px;
        margin: 15px auto;
    }
    .mpi-company-name {
        font-size: 26px;
    }
    .mpi-logo img {
        max-width: 70px;
        max-height: 70px;
    }
}

/* الهواتف */
@media (max-width: 480px) {
    .mpi-invoice {
        padding: 18px 12px;
        margin: 0 auto;
    }
    .mpi-header {
        justify-content: center;
        text-align: center;
        flex-direction: column-reverse;
    }
    .mpi-company-name {
        font-size: 22px;
    }
    .mpi-client-block {
        text-align: center;
    }
    .mpi-items-table-view {
        min-width: 560px;
    }
    .mpi-items-table-view th,
    .mpi-items-table-view td {
        padding: 8px 6px;
        font-size: 12px;
    }
    .mpi-footer {
        justify-content: center;
        text-align: center;
    }
    .mpi-actions {
        flex-direction: column;
    }
    .mpi-btn {
        width: 100%;
    }
}
